Text detection using global geometry estimators

ABSTRACT

Systems, processes and methods for detecting rotated or angled text in an image based on global text geometry estimations are provided. A method includes, at an electronic device with memory and one or more processors, receiving an image including a plurality of pixels (802); determining, based on the image, one or more pixels of the plurality of pixels included in the image that contain text (804); identifying, based on the one or more pixels that contain text, a plurality of components in the image (810); determining a subset of components based on the plurality of components (814); determining, based on the pixels that contain text of the subset of components, one or more candidate text angles (816); determining a global text angle based on the determined one or more candidate text angles (824); and determining a first plurality of bounding boxes based on the global text angle (830).

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is U.S. National Stage patent application of PCT/CN2019/107815 filed on Sep. 25, 2019, entitled “TEXT DETECTION USING GLOBAL GEOMETRY ESTIMATORS,” which is hereby incorporated by reference in its entirety for all purposes.

FIELD

This relates generally to detecting text in images and, more specifically, to detecting rotated or angled text in an image based on global text geometry estimations.

BACKGROUND

Detecting text in images is typically performed by using pixel-level segmentation techniques that leverage deep learning. Such techniques, however, focus on detecting text using local text geometry estimations based on local pixel features from generated feature maps, which can result in inaccurate or suboptimal text detection when text in an image is rotated or angled. It thus can be desirable to refine local text geometry estimations for rotated or angled text by combining the local text geometry estimations with global text geometry estimations in order to compensate for text rotation or angle and thus improve text detection.

SUMMARY

Example methods are disclosed herein. An example method includes, at an electronic device with memory and one or more processors, receiving an image including a plurality of pixels; determining, based on the image, one or more pixels of the plurality of pixels included in the image that contain text; identifying, based on the one or more pixels that contain text, a plurality of components in the image; determining a subset of components based on the plurality of components; determining, based on the pixels that contain text of the subset of components, one or more candidate text angles; determining a global text angle based on the determined one or more candidate text angles; and determining a first plurality of bounding boxes based on the global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components.

Example non-transitory computer-readable media are disclosed herein. An example non-transitory computer-readable storage medium stores one or more programs. The one or more programs comprise instructions, which when executed by one or more processors of an electronic device, cause the electronic device to receive an image including a plurality of pixels; determine, based on the image, one or more pixels of the plurality of pixels included in the image that contain text; identify, based on the one or more pixels that contain text, a plurality of components in the image; determining a subset of components based on the plurality of components; determine, based on the pixels that contain text of the subset of components, one or more candidate text angles; determine a global text angle based on the determined one or more candidate text angles; and determine a first plurality of bounding boxes based on the global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components.

Example electronic devices are disclosed herein. An example electronic device comprises one or more processors; a memory; and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for receiving an image including a plurality of pixels; determining, based on the image, one or more pixels of the plurality of pixels included in the image that contain text; identifying, based on the one or more pixels that contain text, a plurality of components in the image; determining a subset of components based on the plurality of components; determining, based on the pixels that contain text of the subset of components, one or more candidate text angles; determining a global text angle based on the determined one or more candidate text angles; and determining a first plurality of bounding boxes based on the global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components.

An example electronic device comprises means for receiving an image including a plurality of pixels; means for determining, based on the image, one or more pixels of the plurality of pixels included in the image that contain text; means for identifying, based on the one or more pixels that contain text, a plurality of components in the image; means for determining a subset of components based on the plurality of components; means for determining, based on the pixels that contain text of the subset of components, one or more candidate text angles; means for determining a global text angle based on the determined one or more candidate text angles; and means for determining a first plurality of bounding boxes based on the global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components.

Determining a first plurality of bounding boxes based on a global text angle may improve an electronic device's ability to detect rotated or angled text in an image using bounding boxes. Specifically, as explained above, current text detection techniques focus on detecting text using local text geometry estimations based on local pixel features from generated feature maps, which can result in inaccurate or suboptimal text detection when text in an image is rotated or angled. For example, current text detection techniques can result in rotated or angled text (e.g., a rotated or angled word) not being fully enclosed in a bounding box, and thus not being fully detected by an electronic device. Determining a first plurality of bounding boxes based on a global text angle, however, allows an electronic device to account for an angle of rotation for rotated or angled text within an image when determining bounding boxes. Accordingly, determining a first plurality of bounding boxes based on a global text angle allows a text detection system to more accurately and consistently detect rotated or angled text within an image using bounding boxes, which will in turn improve subsequent processing of the detected text (such as optical character recognition (OCR)).

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating a system and environment for implementing a text detection system, according to various examples.

FIG. 2A is a block diagram illustrating a portable multifunction device implementing the client-side portion of a text detection system, according to various examples.

FIG. 2B is a block diagram illustrating exemplary components for event handling, according to various examples.

FIG. 3 illustrates a portable multifunction device implementing the client-side portion of a text detection system, according to various examples.

FIG. 4 is a block diagram of an exemplary multifunction device with a display and a touch-sensitive surface, according to various examples.

FIG. 5A illustrates an exemplary user interface for a menu of applications on a portable multifunction device, according to various examples.

FIG. 5B illustrates an exemplary user interface for a multifunction device with a touch-sensitive surface that is separate from the display, according to various examples.

FIG. 6 illustrates a system for detecting rotated or angled text in an image based on global text geometry estimations, according to various examples.

FIGS. 7A-F illustrate an image that contains angled text at various stages of processing by one or more modules of system 600, according to some examples.

FIG. 8A-C illustrates a flow diagram of a process for detecting rotated or angled text in an image based on global text geometry estimations, according to various examples.

DETAILED DESCRIPTION

In the following description of examples, reference is made to the accompanying drawings in which are shown by way of illustration specific examples that can be practiced. It is to be understood that other examples can be used and structural changes can be made without departing from the scope of the various examples.

The present disclosure generally relates to detecting rotated or angled text in an image based on global text geometry estimations. For example, the present disclosure describes determining a global text angle for rotated or angled text in an image based on local text geometry estimations for the rotated or angled text, and utilizing the determined global text angle to refine the angle of rotation and/or geometry of bounding boxes used to enclose and thus indicate detected text in an image. In this manner, the accuracy and consistency of detecting text using bounding boxes for images that contain rotated or angled text may be improved.

Although the following description uses terms “first,” “second,” etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, a first input could be termed a second input, and, similarly, a second input could be termed a first input, without departing from the scope of the various described examples. The first input and the second input are both inputs and, in some cases, are separate and different inputs.

The terminology used in the description of the various described examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various described examples and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “includes,” “including,” “comprises,” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

The term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in response to detecting,” depending on the context. Similarly, the phrase “if it is determined” or “if [a stated condition or event] is detected” may be construed to mean “upon determining” or “in response to determining” or “upon detecting [the stated condition or event]” or “in response to detecting [the stated condition or event],” depending on the context.

1. System and Environment

FIG. 1 illustrates a block diagram of system 100 according to various examples. In some examples, system 100 implements a text detection system (e.g., system 600 described in greater detail below with reference to FIG. 6).

As shown in FIG. 1, system 100 includes user device 102 and server system 104. User device 102 communicates with server system 104 through one or more networks 106. User device 104 provides client-side functionalities for the text detection system, such as user-facing input and output processing and communication with server system 108. Server system 108 provides server-side functionalities for the text detection system.

User device 102 can be any suitable electronic device. In some examples, user device 102 is a portable multifunctional device (e.g., device 200, described below with reference to FIG. 2A) or a multifunctional device (e.g., device 400, described below with reference to FIG. 4). A portable multifunctional device is, for example, a mobile telephone that also contains other functions, such as PDA and/or music player functions. Specific examples of portable multifunction devices include the Apple Watch®, iPhone®, iPod Touch®, and iPad® devices from Apple Inc. of Cupertino, Calif. Other examples of portable multifunction devices include, without limitation, earphones/headphones, speakers, and laptop or tablet computers. Further, in some examples, user device 102 is a non-portable multifunctional device. In particular, user device 102 is a desktop computer, a game console, a speaker, a television, or a television set-top box. In some examples, user device 102 includes a touch-sensitive surface (e.g., touch screen displays and/or touchpads). Further, user device 102 optionally includes one or more other physical user-interface devices, such as a physical keyboard, a mouse, and/or a joystick. Various examples of electronic devices, such as multifunctional devices, are described below in greater detail.

Server system 104 is implemented on one or more standalone data processing apparatus or a distributed network of computers that include one or more processors 108 and memory 110. In some examples, server system 104 also employs various virtual devices and/or services of third-party service providers (e.g., third-party cloud service providers) to provide the underlying computing resources and/or infrastructure resources of server system 104.

Examples of communication network(s) 106 include local area networks (LAN) and wide area networks (WAN), e.g., the Internet. Communication network(s) 106 is implemented using any known network protocol, including various wired or wireless protocols, such as, for example, Ethernet, Universal Serial Bus (USB), FIREWIRE, Global System for Mobile Communications (GSM), Enhanced Data GSM Environment (EDGE), code division multiple access (CDMA), time division multiple access (TDMA), Bluetooth, Wi-Fi, voice over Internet Protocol (VoIP), Wi-MAX, or any other suitable communication protocol.

Although system 100 shown in FIG. 1 includes both user device 102 and server system 104, in some examples, the functions of the text detection system are implemented on either user device 102 or server system 104. In addition, the divisions of functionalities between the client and server portions of the text detection system can vary in different implementations. For instance, in some examples, user device 102 acts as a thin-client that provides only user-facing input and output processing functions, and delegates all other functionalities of the text detection system to server system 104.

2. Electronic Devices

Attention is now directed toward embodiments of electronic devices for implementing the client-side portion of a text detection system (e.g., at user device 102). FIG. 2A is a block diagram illustrating portable multifunction device 200 with touch-sensitive display system 212 in accordance with some embodiments. Touch-sensitive display 212 is sometimes called a “touch screen” for convenience and is sometimes known as or called a “touch-sensitive display system.” Device 200 includes memory 202 (which optionally includes one or more computer-readable storage mediums), memory controller 222, one or more processing units (CPUs) 220, peripherals interface 218, RF circuitry 208, audio circuitry 210, speaker 211, microphone 213, input/output (I/O) subsystem 206, other input control devices 216, and external port 224. Device 200 optionally includes one or more optical sensors 264. Device 200 optionally includes one or more contact intensity sensors 265 for detecting intensity of contacts on device 200 (e.g., a touch-sensitive surface such as touch-sensitive display system 212 of device 200). Device 200 optionally includes one or more tactile output generators 267 for generating tactile outputs on device 200 (e.g., generating tactile outputs on a touch-sensitive surface such as touch-sensitive display system 212 of device 200 or touchpad 455 of device 400). These components optionally communicate over one or more communication buses or signal lines 203.

As used in the specification and claims, the term “intensity” of a contact on a touch-sensitive surface refers to the force or pressure (force per unit area) of a contact (e.g., a finger contact) on the touch-sensitive surface, or to a substitute (proxy) for the force or pressure of a contact on the touch-sensitive surface. The intensity of a contact has a range of values that includes at least four distinct values and more typically includes hundreds of distinct values (e.g., at least 256). Intensity of a contact is, optionally, determined (or measured) using various approaches and various sensors or combinations of sensors. For example, one or more force sensors underneath or adjacent to the touch-sensitive surface are, optionally, used to measure force at various points on the touch-sensitive surface. In some implementations, force measurements from multiple force sensors are combined (e.g., a weighted average) to determine an estimated force of a contact. Similarly, a pressure-sensitive tip of a stylus is, optionally, used to determine a pressure of the stylus on the touch-sensitive surface. Alternatively, the size of the contact area detected on the touch-sensitive surface and/or changes thereto, the capacitance of the touch-sensitive surface proximate to the contact and/or changes thereto, and/or the resistance of the touch-sensitive surface proximate to the contact and/or changes thereto are, optionally, used as a substitute for the force or pressure of the contact on the touch-sensitive surface. In some implementations, the substitute measurements for contact force or pressure are used directly to determine whether an intensity threshold has been exceeded (e.g., the intensity threshold is described in units corresponding to the substitute measurements). In some implementations, the substitute measurements for contact force or pressure are converted to an estimated force or pressure, and the estimated force or pressure is used to determine whether an intensity threshold has been exceeded (e.g., the intensity threshold is a pressure threshold measured in units of pressure). Using the intensity of a contact as an attribute of a user input allows for user access to additional device functionality that may otherwise not be accessible by the user on a reduced-size device with limited real estate for displaying affordances (e.g., on a touch-sensitive display) and/or receiving user input (e.g., via a touch-sensitive display, a touch-sensitive surface, or a physical/mechanical control such as a knob or a button).

As used in the specification and claims, the term “tactile output” refers to physical displacement of a device relative to a previous position of the device, physical displacement of a component (e.g., a touch-sensitive surface) of a device relative to another component (e.g., housing) of the device, or displacement of the component relative to a center of mass of the device that will be detected by a user with the user's sense of touch. For example, in situations where the device or the component of the device is in contact with a surface of a user that is sensitive to touch (e.g., a finger, palm, or other part of a user's hand), the tactile output generated by the physical displacement will be interpreted by the user as a tactile sensation corresponding to a perceived change in physical characteristics of the device or the component of the device. For example, movement of a touch-sensitive surface (e.g., a touch-sensitive display or trackpad) is, optionally, interpreted by the user as a “down click” or “up click” of a physical actuator button. In some cases, a user will feel a tactile sensation such as an “down click” or “up click” even when there is no movement of a physical actuator button associated with the touch-sensitive surface that is physically pressed (e.g., displaced) by the user's movements. As another example, movement of the touch-sensitive surface is, optionally, interpreted or sensed by the user as “roughness” of the touch-sensitive surface, even when there is no change in smoothness of the touch-sensitive surface. While such interpretations of touch by a user will be subject to the individualized sensory perceptions of the user, there are many sensory perceptions of touch that are common to a large majority of users. Thus, when a tactile output is described as corresponding to a particular sensory perception of a user (e.g., an “up click,” a “down click,” “roughness”), unless otherwise stated, the generated tactile output corresponds to physical displacement of the device or a component thereof that will generate the described sensory perception for a typical (or average) user.

It should be appreciated that device 200 is only one example of a portable multifunction device, and that device 200 optionally has more or fewer components than shown, optionally combines two or more components, or optionally has a different configuration or arrangement of the components. The various components shown in FIG. 2A are implemented in hardware, software, or a combination of both hardware and software, including one or more signal processing and/or application-specific integrated circuits.

Memory 202 includes one or more computer-readable storage mediums. The computer-readable storage mediums are, for example, tangible and non-transitory. Memory 202 includes high-speed random access memory and also includes non-volatile memory, such as one or more magnetic disk storage devices, flash memory devices, or other non-volatile solid-state memory devices. Memory controller 222 controls access to memory 202 by other components of device 200.

In some examples, a non-transitory computer-readable storage medium of memory 202 is used to store instructions (e.g., for performing aspects of processes described below) for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. In other examples, the instructions (e.g., for performing aspects of the processes described below) are stored on a non-transitory computer-readable storage medium (not shown) of the server system 104 or are divided between the non-transitory computer-readable storage medium of memory 202 and the non-transitory computer-readable storage medium of server system 104.

Peripherals interface 218 is used to couple input and output peripherals of the device to CPU 220 and memory 202. The one or more processors 220 run or execute various software programs and/or sets of instructions stored in memory 202 to perform various functions for device 200 and to process data. In some embodiments, peripherals interface 218, CPU 220, and memory controller 222 are implemented on a single chip, such as chip 204. In some other embodiments, they are implemented on separate chips.

RF (radio frequency) circuitry 208 receives and sends RF signals, also called electromagnetic signals. RF circuitry 208 converts electrical signals to/from electromagnetic signals and communicates with communications networks and other communications devices via the electromagnetic signals. RF circuitry 208 optionally includes well-known circuitry for performing these functions, including but not limited to an antenna system, an RF transceiver, one or more amplifiers, a tuner, one or more oscillators, a digital signal processor, a CODEC chipset, a subscriber identity module (SIM) card, memory, and so forth. RF circuitry 208 optionally communicates with networks, such as the Internet, also referred to as the World Wide Web (WWW), an intranet and/or a wireless network, such as a cellular telephone network, a wireless local area network (LAN) and/or a metropolitan area network (MAN), and other devices by wireless communication. The RF circuitry 208 optionally includes well-known circuitry for detecting near field communication (NFC) fields, such as by a short-range communication radio. The wireless communication optionally uses any of a plurality of communications standards, protocols, and technologies, including but not limited to Global System for Mobile Communications (GSM), Enhanced Data GSM Environment (EDGE), high-speed downlink packet access (HSDPA), high-speed uplink packet access (HSUPA), Evolution, Data-Only (EV-DO), HSPA, HSPA+, Dual-Cell HSPA (DC-HSPDA), long term evolution (LTE), near field communication (NFC), wideband code division multiple access (W-CDMA), code division multiple access (CDMA), time division multiple access (TDMA), Bluetooth, Bluetooth Low Energy (BTLE), Wireless Fidelity (Wi-Fi) (e.g., IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, IEEE 802.11n, and/or IEEE 802.11ac), voice over Internet Protocol (VoIP), Wi-MAX, a protocol for e mail (e.g., Internet message access protocol (IMAP) and/or post office protocol (POP)), instant messaging (e.g., extensible messaging and presence protocol (XMPP), Session Initiation Protocol for Instant Messaging and Presence Leveraging Extensions (SIMPLE), Instant Messaging and Presence Service (IMPS)), and/or Short Message Service (SMS), or any other suitable communication protocol, including communication protocols not yet developed as of the filing date of this document.

Audio circuitry 210, speaker 211, and microphone 213 provide an audio interface between a user and device 200. Audio circuitry 210 receives audio data from peripherals interface 218, converts the audio data to an electrical signal, and transmits the electrical signal to speaker 211. Speaker 211 converts the electrical signal to human-audible sound waves. Audio circuitry 210 also receives electrical signals converted by microphone 213 from sound waves. Audio circuitry 210 converts the electrical signal to audio data and transmits the audio data to peripherals interface 218 for processing. Audio data are retrieved from and/or transmitted to memory 202 and/or RF circuitry 208 by peripherals interface 218. In some embodiments, audio circuitry 210 also includes a headset jack (e.g., 312, FIG. 3). The headset jack provides an interface between audio circuitry 210 and removable audio input/output peripherals, such as output-only headphones or a headset with both output (e.g., a headphone for one or both ears) and input (e.g., a microphone).

I/O subsystem 206 couples input/output peripherals on device 200, such as touch screen 212 and other input control devices 216, to peripherals interface 218. I/O subsystem 206 optionally includes display controller 256, optical sensor controller 258, intensity sensor controller 259, haptic feedback controller 261, and one or more input controllers 260 for other input or control devices. The one or more input controllers 260 receive/send electrical signals from/to other input control devices 216. The other input control devices 216 optionally include physical buttons (e.g., push buttons, rocker buttons, etc.), dials, slider switches, joysticks, click wheels, and so forth. In some alternate embodiments, input controller(s) 260 are, optionally, coupled to any (or none) of the following: a keyboard, an infrared port, a USB port, and a pointer device such as a mouse. The one or more buttons (e.g., 308, FIG. 3) optionally include an up/down button for volume control of speaker 211 and/or microphone 213. The one or more buttons optionally include a push button (e.g., 306, FIG. 3).

A quick press of the push button disengages a lock of touch screen 212 or begin a process that uses gestures on the touch screen to unlock the device, as described in U.S. patent application Ser. No. 11/322,549, “Unlocking a Device by Performing Gestures on an Unlock Image,” filed Dec. 23, 2005, U.S. Pat. No. 7,657,849, which is hereby incorporated by reference in its entirety. A longer press of the push button (e.g., 306) turns power to device 200 on or off. The user is able to customize a functionality of one or more of the buttons. Touch screen 212 is used to implement virtual or soft buttons and one or more soft keyboards.

Touch-sensitive display 212 provides an input interface and an output interface between the device and a user. Display controller 256 receives and/or sends electrical signals from/to touch screen 212. Touch screen 212 displays visual output to the user. The visual output includes graphics, text, icons, video, and any combination thereof (collectively termed “graphics”). In some embodiments, some or all of the visual output correspond to user-interface objects.

Touch screen 212 has a touch-sensitive surface, sensor, or set of sensors that accepts input from the user based on haptic and/or tactile contact. Touch screen 212 and display controller 256 (along with any associated modules and/or sets of instructions in memory 202) detect contact (and any movement or breaking of the contact) on touch screen 212 and convert the detected contact into interaction with user-interface objects (e.g., one or more soft keys, icons, web pages, or images) that are displayed on touch screen 212. In an exemplary embodiment, a point of contact between touch screen 212 and the user corresponds to a finger of the user.

Touch screen 212 uses LCD (liquid crystal display) technology, LPD (light emitting polymer display) technology, or LED (light emitting diode) technology, although other display technologies may be used in other embodiments. Touch screen 212 and display controller 256 detect contact and any movement or breaking thereof using any of a plurality of touch sensing technologies now known or later developed, including but not limited to capacitive, resistive, infrared, and surface acoustic wave technologies, as well as other proximity sensor arrays or other elements for determining one or more points of contact with touch screen 212. In an exemplary embodiment, projected mutual capacitance sensing technology is used, such as that found in the iPhone® and iPod Touch® from Apple Inc. of Cupertino, Calif.

A touch-sensitive display in some embodiments of touch screen 212 is analogous to the multi-touch sensitive touchpads described in the following U.S. Pat. No. 6,323,846 (Westerman et al.), U.S. Pat. No. 6,570,557 (Westerman et al.), and/or U.S. Pat. No. 6,677,932 (Westerman), and/or U.S. Patent Publication 2002/0015024A1, each of which is hereby incorporated by reference in its entirety. However, touch screen 212 displays visual output from device 200, whereas touch-sensitive touchpads do not provide visual output.

A touch-sensitive display in some embodiments of touch screen 212 is as described in the following applications: (1) U.S. patent application Ser. No. 11/381,313, “Multipoint Touch Surface Controller,” filed May 2, 2006; (2) U.S. patent application Ser. No. 10/840,862, “Multipoint Touchscreen,” filed May 6, 2004; (3) U.S. patent application Ser. No. 10/903,964, “Gestures For Touch Sensitive Input Devices,” filed Jul. 30, 2004; (4) U.S. patent application Ser. No. 11/048,264, “Gestures For Touch Sensitive Input Devices,” filed Jan. 31, 2005; (5) U.S. patent application Ser. No. 11/038,590, “Mode-Based Graphical User Interfaces For Touch Sensitive Input Devices,” filed Jan. 18, 2005; (6) U.S. patent application Ser. No. 11/228,758, “Virtual Input Device Placement On A Touch Screen User Interface,” filed Sep. 16, 2005; (7) U.S. patent application Ser. No. 11/228,700, “Operation Of A Computer With A Touch Screen Interface,” filed Sep. 16, 2005; (8) U.S. patent application Ser. No. 11/228,737, “Activating Virtual Keys Of A Touch-Screen Virtual Keyboard,” filed Sep. 16, 2005; and (9) U.S. patent application Ser. No. 11/367,749, “Multi-Functional Hand-Held Device,” filed Mar. 3, 2006. All of these applications are incorporated by reference herein in their entirety.

Touch screen 212 has, for example, a video resolution in excess of 100 dpi. In some embodiments, the touch screen has a video resolution of approximately 160 dpi. The user makes contact with touch screen 212 using any suitable object or appendage, such as a stylus, a finger, and so forth. In some embodiments, the user interface is designed to work primarily with finger-based contacts and gestures, which can be less precise than stylus-based input due to the larger area of contact of a finger on the touch screen. In some embodiments, the device translates the rough finger-based input into a precise pointer/cursor position or command for performing the actions desired by the user.

In some embodiments, in addition to the touch screen, device 200 includes a touchpad (not shown) for activating or deactivating particular functions. In some embodiments, the touchpad is a touch-sensitive area of the device that, unlike the touch screen, does not display visual output. The touchpad is a touch-sensitive surface that is separate from touch screen 212 or an extension of the touch-sensitive surface formed by the touch screen.

Device 200 also includes power system 262 for powering the various components. Power system 262 includes a power management system, one or more power sources (e.g., battery, alternating current (AC)), a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator (e.g., a light-emitting diode (LED)) and any other components associated with the generation, management and distribution of power in portable devices.

Device 200 also includes one or more optical sensors 264. FIG. 2A shows an optical sensor coupled to optical sensor controller 258 in I/O subsystem 206. Optical sensor 264 includes charge-coupled device (CCD) or complementary metal-oxide semiconductor (CMOS) phototransistors. Optical sensor 264 receives light from the environment, projected through one or more lenses, and converts the light to data representing an image. In conjunction with imaging module 243 (also called a camera module), optical sensor 264 captures still images or video. In some embodiments, an optical sensor is located on the back of device 200, opposite touch screen display 212 on the front of the device so that the touch screen display is used as a viewfinder for still and/or video image acquisition. In some embodiments, an optical sensor is located on the front of the device so that the user's image is obtained for video conferencing while the user views the other video conference participants on the touch screen display. In some embodiments, the position of optical sensor 264 can be changed by the user (e.g., by rotating the lens and the sensor in the device housing) so that a single optical sensor 264 is used along with the touch screen display for both video conferencing and still and/or video image acquisition.

Device 200 optionally also includes one or more contact intensity sensors 265. FIG. 2A shows a contact intensity sensor coupled to intensity sensor controller 259 in I/O subsystem 206. Contact intensity sensor 265 optionally includes one or more piezoresistive strain gauges, capacitive force sensors, electric force sensors, piezoelectric force sensors, optical force sensors, capacitive touch-sensitive surfaces, or other intensity sensors (e.g., sensors used to measure the force (or pressure) of a contact on a touch-sensitive surface). Contact intensity sensor 265 receives contact intensity information (e.g., pressure information or a proxy for pressure information) from the environment. In some embodiments, at least one contact intensity sensor is collocated with, or proximate to, a touch-sensitive surface (e.g., touch-sensitive display system 212). In some embodiments, at least one contact intensity sensor is located on the back of device 200, opposite touch screen display 212, which is located on the front of device 200.

Device 200 also includes one or more proximity sensors 266. FIG. 2A shows proximity sensor 266 coupled to peripherals interface 218. Alternately, proximity sensor 266 is coupled to input controller 260 in I/O subsystem 206. Proximity sensor 266 is performed as described in U.S. patent application Ser. No. 11/241,839, “Proximity Detector In Handheld Device”; Ser. No. 11/240,788, “Proximity Detector In Handheld Device”; Ser. No. 11/620,702, “Using Ambient Light Sensor To Augment Proximity Sensor Output”; Ser. No. 11/586,862, “Automated Response To And Sensing Of User Activity In Portable Devices”; and Ser. No. 11/638,251, “Methods And Systems For Automatic Configuration Of Peripherals,” which are hereby incorporated by reference in their entirety. In some embodiments, the proximity sensor turns off and disables touch screen 212 when the multifunction device is placed near the user's ear (e.g., when the user is making a phone call).

Device 200 optionally also includes one or more tactile output generators 267. FIG. 2A shows a tactile output generator coupled to haptic feedback controller 261 in I/O subsystem 206. Tactile output generator 267 optionally includes one or more electroacoustic devices such as speakers or other audio components and/or electromechanical devices that convert energy into linear motion such as a motor, solenoid, electroactive polymer, piezoelectric actuator, electrostatic actuator, or other tactile output generating component (e.g., a component that converts electrical signals into tactile outputs on the device). Contact intensity sensor 265 receives tactile feedback generation instructions from haptic feedback module 233 and generates tactile outputs on device 200 that are capable of being sensed by a user of device 200. In some embodiments, at least one tactile output generator is collocated with, or proximate to, a touch-sensitive surface (e.g., touch-sensitive display system 212) and, optionally, generates a tactile output by moving the touch-sensitive surface vertically (e.g., in/out of a surface of device 200) or laterally (e.g., back and forth in the same plane as a surface of device 200). In some embodiments, at least one tactile output generator sensor is located on the back of device 200, opposite touch screen display 212, which is located on the front of device 200.

Device 200 also includes one or more accelerometers 268. FIG. 2A shows accelerometer 268 coupled to peripherals interface 218. Alternately, accelerometer 268 is coupled to an input controller 260 in I/O subsystem 206. Accelerometer 268 performs, for example, as described in U.S. Patent Publication No. 20050190059, “Acceleration-based Theft Detection System for Portable Electronic Devices,” and U.S. Patent Publication No. 20060017692, “Methods And Apparatuses For Operating A Portable Device Based On An Accelerometer,” both of which are incorporated by reference herein in their entirety. In some embodiments, information is displayed on the touch screen display in a portrait view or a landscape view based on an analysis of data received from the one or more accelerometers. Device 200 optionally includes, in addition to accelerometer(s) 268, a magnetometer (not shown) and a GPS (or GLONASS or other global navigation system) receiver (not shown) for obtaining information concerning the location and orientation (e.g., portrait or landscape) of device 200.

In some embodiments, the software components stored in memory 202 include operating system 226, communication module (or set of instructions) 228, contact/motion module (or set of instructions) 230, graphics module (or set of instructions) 232, text input module (or set of instructions) 234, Global Positioning System (GPS) module (or set of instructions) 235, Digital Assistant Client Module 229, and applications (or sets of instructions) 236. Further, memory 202 stores data and models, such as user data and models 231. Furthermore, in some embodiments, memory 202 (FIG. 2A) or 470 (FIG. 4) stores device/global internal state 257, as shown in FIGS. 2A and 4. Device/global internal state 257 includes one or more of: active application state, indicating which applications, if any, are currently active; display state, indicating what applications, views or other information occupy various regions of touch screen display 212; sensor state, including information obtained from the device's various sensors and input control devices 216; and location information concerning the device's location and/or attitude.

Operating system 226 (e.g., Darwin, RTXC, LINUX, UNIX, OS X, iOS, WINDOWS, or an embedded operating system such as VxWorks) includes various software components and/or drivers for controlling and managing general system tasks (e.g., memory management, storage device control, power management, etc.) and facilitates communication between various hardware and software components.

Communication module 228 facilitates communication with other devices over one or more external ports 224 and also includes various software components for handling data received by RF circuitry 208 and/or external port 224. External port 224 (e.g., Universal Serial Bus (USB), FIREWIRE, etc.) is adapted for coupling directly to other devices or indirectly over a network (e.g., the Internet, wireless LAN, etc.). In some embodiments, the external port is a multi-pin (e.g., 30-pin) connector that is the same as, or similar to and/or compatible with, the 30-pin connector used on iPod® (trademark of Apple Inc.) devices.

Contact/motion module 230 optionally detects contact with touch screen 212 (in conjunction with display controller 256) and other touch-sensitive devices (e.g., a touchpad or physical click wheel). Contact/motion module 230 includes various software components for performing various operations related to detection of contact, such as determining if contact has occurred (e.g., detecting a finger-down event), determining an intensity of the contact (e.g., the force or pressure of the contact or a substitute for the force or pressure of the contact), determining if there is movement of the contact and tracking the movement across the touch-sensitive surface (e.g., detecting one or more finger-dragging events), and determining if the contact has ceased (e.g., detecting a finger-up event or a break in contact). Contact/motion module 230 receives contact data from the touch-sensitive surface. Determining movement of the point of contact, which is represented by a series of contact data, optionally includes determining speed (magnitude), velocity (magnitude and direction), and/or an acceleration (a change in magnitude and/or direction) of the point of contact. These operations are, optionally, applied to single contacts (e.g., one finger contacts) or to multiple simultaneous contacts (e.g., “multitouch”/multiple finger contacts). In some embodiments, contact/motion module 230 and display controller 256 detect contact on a touchpad.

In some embodiments, contact/motion module 230 uses a set of one or more intensity thresholds to determine whether an operation has been performed by a user (e.g., to determine whether a user has “clicked” on an icon). In some embodiments, at least a subset of the intensity thresholds are determined in accordance with software parameters (e.g., the intensity thresholds are not determined by the activation thresholds of particular physical actuators and can be adjusted without changing the physical hardware of device 200). For example, a mouse “click” threshold of a trackpad or touch screen display can be set to any of a large range of predefined threshold values without changing the trackpad or touch screen display hardware. Additionally, in some implementations, a user of the device is provided with software settings for adjusting one or more of the set of intensity thresholds (e.g., by adjusting individual intensity thresholds and/or by adjusting a plurality of intensity thresholds at once with a system-level click “intensity” parameter).

Contact/motion module 230 optionally detects a gesture input by a user. Different gestures on the touch-sensitive surface have different contact patterns (e.g., different motions, timings, and/or intensities of detected contacts). Thus, a gesture is, optionally, detected by detecting a particular contact pattern. For example, detecting a finger tap gesture includes detecting a finger-down event followed by detecting a finger-up (liftoff) event at the same position (or substantially the same position) as the finger-down event (e.g., at the position of an icon). As another example, detecting a finger swipe gesture on the touch-sensitive surface includes detecting a finger-down event followed by detecting one or more finger-dragging events, and subsequently followed by detecting a finger-up (liftoff) event.

Graphics module 232 includes various known software components for rendering and displaying graphics on touch screen 212 or other display, including components for changing the visual impact (e.g., brightness, transparency, saturation, contrast, or other visual property) of graphics that are displayed. As used herein, the term “graphics” includes any object that can be displayed to a user, including, without limitation, text, web pages, icons (such as user-interface objects including soft keys), digital images, videos, animations, and the like.

In some embodiments, graphics module 232 stores data representing graphics to be used. Each graphic is, optionally, assigned a corresponding code. Graphics module 232 receives, from applications etc., one or more codes specifying graphics to be displayed along with, if necessary, coordinate data and other graphic property data, and then generates screen image data to output to display controller 256.

Haptic feedback module 233 includes various software components for generating instructions used by tactile output generator(s) 267 to produce tactile outputs at one or more locations on device 200 in response to user interactions with device 200.

Text input module 234, which is, in some examples, a component of graphics module 232, provides soft keyboards for entering text in various applications (e.g., contacts 237, email 240, IM 241, browser 247, and any other application that needs text input).

GPS module 235 determines the location of the device and provides this information for use in various applications (e.g., to telephone 238 for use in location-based dialing; to camera 243 as picture/video metadata; and to applications that provide location-based services such as weather widgets, local yellow page widgets, and map/navigation widgets).

Digital assistant client module 229 includes various client-side digital assistant instructions to provide the client-side functionalities of the digital assistant. For example, digital assistant client module 229 is capable of accepting voice input (e.g., speech input), text input, touch input, and/or gestural input through various user interfaces (e.g., microphone 213, accelerometer(s) 268, touch-sensitive display system 212, optical sensor(s) 264, other input control devices 216, etc.) of portable multifunction device 200. Digital assistant client module 229 is also capable of providing output in audio (e.g., speech output), visual, and/or tactile forms through various output interfaces (e.g., speaker 211, touch-sensitive display system 212, tactile output generator(s) 267, etc.) of portable multifunction device 200. For example, output is provided as voice, sound, alerts, text messages, menus, graphics, videos, animations, vibrations, and/or combinations of two or more of the above.

User data and models 231 include various data associated with the user (e.g., user-specific vocabulary data, user preference data, user-specified name pronunciations, data from the user's electronic address book, to-do lists, shopping lists, etc.) to provide the client-side functionalities of the digital assistant. Further, user data and models 231 include various models (e.g., speech recognition models, statistical language models, natural language processing models, ontology, task flow models, service models, etc.) for processing user input and determining user intent.

In some examples, digital assistant client module 229 utilizes the various sensors, subsystems, and peripheral devices of portable multifunction device 200 to gather additional information from the surrounding environment of the portable multifunction device 200 to establish a context associated with a user, the current user interaction, and/or the current user input. Contextual information is referred to as context data.

In some examples, the contextual information that accompanies the user input includes sensor information, e.g., lighting, ambient noise, ambient temperature, images or videos of the surrounding environment, etc. In some examples, the contextual information can also include the physical state of the device, e.g., device orientation, device location, device temperature, power level, speed, acceleration, motion patterns, cellular signals strength, etc.

Applications 236 include the following modules (or sets of instructions), or a subset or superset thereof:

-   -   Contacts module 237 (sometimes called an address book or contact         list);     -   Telephone module 238;     -   Video conference module 239;     -   E-mail client module 240;     -   Instant messaging (IM) module 241;     -   Workout support module 242;     -   Camera module 243 for still and/or video images;     -   Image management module 244;     -   Video player module;     -   Music player module;     -   Browser module 247;     -   Calendar module 248;     -   Widget modules 249, which includes, in some examples, one or         more of: weather widget 249-1, stocks widget 249-2, calculator         widget 249-3, alarm clock widget 249-4, dictionary widget 249-5,         and other widgets obtained by the user, as well as user-created         widgets 249-6;     -   Widget creator module 250 for making user-created widgets 249-6;     -   Search module 251;     -   Video and music player module 252, which merges video player         module and music player module;     -   Notes module 253;     -   Map module 254; and/or     -   Online video module 255.

Examples of other applications 236 that are stored in memory 202 include other word processing applications, other image editing applications, drawing applications, presentation applications, JAVA-enabled applications, encryption, digital rights management, voice recognition, and voice replication.

In conjunction with touch screen 212, display controller 256, contact/motion module 230, graphics module 232, and text input module 234, contacts module 237 are used to manage an address book or contact list (e.g., stored in application internal state 292 of contacts module 237 in memory 202 or memory 470), including: adding name(s) to the address book; deleting name(s) from the address book; associating telephone number(s), e-mail address(es), physical address(es) or other information with a name; associating an image with a name; categorizing and sorting names; providing telephone numbers or e-mail addresses to initiate and/or facilitate communications by telephone 238, video conference module 239, e-mail 240, or IM 241; and so forth.

In conjunction with RF circuitry 208, audio circuitry 210, speaker 211, microphone 213, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, and text input module 234, telephone module 238 are used to enter a sequence of characters corresponding to a telephone number, access one or more telephone numbers in contacts module 237, modify a telephone number that has been entered, dial a respective telephone number, conduct a conversation, and disconnect or hang up when the conversation is completed. As noted above, the wireless communication uses any of a plurality of communications standards, protocols, and technologies.

In conjunction with RF circuitry 208, audio circuitry 210, speaker 211, microphone 213, touch screen 212, display controller 256, optical sensor 264, optical sensor controller 258, contact/motion module 230, graphics module 232, text input module 234, contacts module 237, and telephone module 238, video conference module 239 includes executable instructions to initiate, conduct, and terminate a video conference between a user and one or more other participants in accordance with user instructions.

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, and text input module 234, e-mail client module 240 includes executable instructions to create, send, receive, and manage e-mail in response to user instructions. In conjunction with image management module 244, e-mail client module 240 makes it very easy to create and send e-mails with still or video images taken with camera module 243.

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, and text input module 234, the instant messaging module 241 includes executable instructions to enter a sequence of characters corresponding to an instant message, to modify previously entered characters, to transmit a respective instant message (for example, using a Short Message Service (SMS) or Multimedia Message Service (MMS) protocol for telephony-based instant messages or using XMPP, SIMPLE, or IMPS for Internet-based instant messages), to receive instant messages, and to view received instant messages. In some embodiments, transmitted and/or received instant messages include graphics, photos, audio files, video files and/or other attachments as are supported in an MMS and/or an Enhanced Messaging Service (EMS). As used herein, “instant messaging” refers to both telephony-based messages (e.g., messages sent using SMS or MMS) and Internet-based messages (e.g., messages sent using XMPP, SIMPLE, or IMPS).

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, text input module 234, GPS module 235, map module 254, and music player module, workout support module 242 includes executable instructions to create workouts (e.g., with time, distance, and/or calorie burning goals); communicate with workout sensors (sports devices); receive workout sensor data; calibrate sensors used to monitor a workout; select and play music for a workout; and display, store, and transmit workout data.

In conjunction with touch screen 212, display controller 256, optical sensor(s) 264, optical sensor controller 258, contact/motion module 230, graphics module 232, and image management module 244, camera module 243 includes executable instructions to capture still images or video (including a video stream) and store them into memory 202, modify characteristics of a still image or video, or delete a still image or video from memory 202.

In conjunction with touch screen 212, display controller 256, contact/motion module 230, graphics module 232, text input module 234, and camera module 243, image management module 244 includes executable instructions to arrange, modify (e.g., edit), or otherwise manipulate, label, delete, present (e.g., in a digital slide show or album), and store still and/or video images.

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, and text input module 234, browser module 247 includes executable instructions to browse the Internet in accordance with user instructions, including searching, linking to, receiving, and displaying web pages or portions thereof, as well as attachments and other files linked to web pages.

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, text input module 234, e-mail client module 240, and browser module 247, calendar module 248 includes executable instructions to create, display, modify, and store calendars and data associated with calendars (e.g., calendar entries, to-do lists, etc.) in accordance with user instructions.

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, text input module 234, and browser module 247, widget modules 249 are mini-applications that can be downloaded and used by a user (e.g., weather widget 249-1, stocks widget 249-2, calculator widget 249-3, alarm clock widget 249-4, and dictionary widget 249-5) or created by the user (e.g., user-created widget 249-6). In some embodiments, a widget includes an HTML (Hypertext Markup Language) file, a CSS (Cascading Style Sheets) file, and a JavaScript file. In some embodiments, a widget includes an XML (Extensible Markup Language) file and a JavaScript file (e.g., Yahoo! Widgets).

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, text input module 234, and browser module 247, the widget creator module 250 are used by a user to create widgets (e.g., turning a user-specified portion of a web page into a widget).

In conjunction with touch screen 212, display controller 256, contact/motion module 230, graphics module 232, and text input module 234, search module 251 includes executable instructions to search for text, music, sound, image, video, and/or other files in memory 202 that match one or more search criteria (e.g., one or more user-specified search terms) in accordance with user instructions.

In conjunction with touch screen 212, display controller 256, contact/motion module 230, graphics module 232, audio circuitry 210, speaker 211, RF circuitry 208, and browser module 247, video and music player module 252 includes executable instructions that allow the user to download and play back recorded music and other sound files stored in one or more file formats, such as MP3 or AAC files, and executable instructions to display, present, or otherwise play back videos (e.g., on touch screen 212 or on an external, connected display via external port 224). In some embodiments, device 200 optionally includes the functionality of an MP3 player, such as an iPod (trademark of Apple Inc.).

In conjunction with touch screen 212, display controller 256, contact/motion module 230, graphics module 232, and text input module 234, notes module 253 includes executable instructions to create and manage notes, to-do lists, and the like in accordance with user instructions.

In conjunction with RF circuitry 208, touch screen 212, display controller 256, contact/motion module 230, graphics module 232, text input module 234, GPS module 235, and browser module 247, map module 254 are used to receive, display, modify, and store maps and data associated with maps (e.g., driving directions, data on stores and other points of interest at or near a particular location, and other location-based data) in accordance with user instructions.

In conjunction with touch screen 212, display controller 256, contact/motion module 230, graphics module 232, audio circuitry 210, speaker 211, RF circuitry 208, text input module 234, e-mail client module 240, and browser module 247, online video module 255 includes instructions that allow the user to access, browse, receive (e.g., by streaming and/or download), play back (e.g., on the touch screen or on an external, connected display via external port 224), send an e-mail with a link to a particular online video, and otherwise manage online videos in one or more file formats, such as H.264. In some embodiments, instant messaging module 241, rather than e-mail client module 240, is used to send a link to a particular online video. Additional description of the online video application can be found in U.S. Provisional Patent Application No. 60/936,562, “Portable Multifunction Device, Method, and Graphical User Interface for Playing Online Videos,” filed Jun. 20, 2007, and U.S. patent application Ser. No. 11/968,067, “Portable Multifunction Device, Method, and Graphical User Interface for Playing Online Videos,” filed Dec. 31, 2007, the contents of which are hereby incorporated by reference in their entirety.

Each of the above-identified modules and applications corresponds to a set of executable instructions for performing one or more functions described above and the methods described in this application (e.g., the computer-implemented methods and other information processing methods described herein). These modules (e.g., sets of instructions) need not be implemented as separate software programs, procedures, or modules, and thus various subsets of these modules can be combined or otherwise rearranged in various embodiments. For example, video player module can be combined with music player module into a single module (e.g., video and music player module 252, FIG. 2A). In some embodiments, memory 202 stores a subset of the modules and data structures identified above. Furthermore, memory 202 stores additional modules and data structures not described above.

In some embodiments, device 200 is a device where operation of a predefined set of functions on the device is performed exclusively through a touch screen and/or a touchpad. By using a touch screen and/or a touchpad as the primary input control device for operation of device 200, the number of physical input control devices (such as push buttons, dials, and the like) on device 200 is reduced.

The predefined set of functions that are performed exclusively through a touch screen and/or a touchpad optionally include navigation between user interfaces. In some embodiments, the touchpad, when touched by the user, navigates device 200 to a main, home, or root menu from any user interface that is displayed on device 200. In such embodiments, a “menu button” is implemented using a touchpad. In some other embodiments, the menu button is a physical push button or other physical input control device instead of a touchpad.

FIG. 2B is a block diagram illustrating exemplary components for event handling in accordance with some embodiments. In some embodiments, memory 202 (FIG. 2A) or 470 (FIG. 4) includes event sorter 270 (e.g., in operating system 226) and a respective application 236-1 (e.g., any of the aforementioned applications 237-251, 255, 480-490).

Event sorter 270 receives event information and determines the application 236-1 and application view 291 of application 236-1 to which to deliver the event information. Event sorter 270 includes event monitor 271 and event dispatcher module 274. In some embodiments, application 236-1 includes application internal state 292, which indicates the current application view(s) displayed on touch-sensitive display 212 when the application is active or executing. In some embodiments, device/global internal state 257 is used by event sorter 270 to determine which application(s) is (are) currently active, and application internal state 292 is used by event sorter 270 to determine application views 291 to which to deliver event information.

In some embodiments, application internal state 292 includes additional information, such as one or more of: resume information to be used when application 236-1 resumes execution, user interface state information that indicates information being displayed or that is ready for display by application 236-1, a state queue for enabling the user to go back to a prior state or view of application 236-1, and a redo/undo queue of previous actions taken by the user.

Event monitor 271 receives event information from peripherals interface 218. Event information includes information about a sub-event (e.g., a user touch on touch-sensitive display 212, as part of a multi-touch gesture). Peripherals interface 218 transmits information it receives from I/O subsystem 206 or a sensor, such as proximity sensor 266, accelerometer(s) 268, and/or microphone 213 (through audio circuitry 210). Information that peripherals interface 218 receives from I/O subsystem 206 includes information from touch-sensitive display 212 or a touch-sensitive surface.

In some embodiments, event monitor 271 sends requests to the peripherals interface 218 at predetermined intervals. In response, peripherals interface 218 transmits event information. In other embodiments, peripherals interface 218 transmits event information only when there is a significant event (e.g., receiving an input above a predetermined noise threshold and/or for more than a predetermined duration).

In some embodiments, event sorter 270 also includes a hit view determination module 272 and/or an active event recognizer determination module 273.

Hit view determination module 272 provides software procedures for determining where a sub-event has taken place within one or more views when touch-sensitive display 212 displays more than one view. Views are made up of controls and other elements that a user can see on the display.

Another aspect of the user interface associated with an application is a set of views, sometimes herein called application views or user interface windows, in which information is displayed and touch-based gestures occur. The application views (of a respective application) in which a touch is detected correspond to programmatic levels within a programmatic or view hierarchy of the application. For example, the lowest level view in which a touch is detected is called the hit view, and the set of events that are recognized as proper inputs is determined based, at least in part, on the hit view of the initial touch that begins a touch-based gesture.

Hit view determination module 272 receives information related to sub events of a touch-based gesture. When an application has multiple views organized in a hierarchy, hit view determination module 272 identifies a hit view as the lowest view in the hierarchy which should handle the sub-event. In most circumstances, the hit view is the lowest level view in which an initiating sub-event occurs (e.g., the first sub-event in the sequence of sub-events that form an event or potential event). Once the hit view is identified by the hit view determination module 272, the hit view typically receives all sub-events related to the same touch or input source for which it was identified as the hit view.

Active event recognizer determination module 273 determines which view or views within a view hierarchy should receive a particular sequence of sub-events. In some embodiments, active event recognizer determination module 273 determines that only the hit view should receive a particular sequence of sub-events. In other embodiments, active event recognizer determination module 273 determines that all views that include the physical location of a sub-event are actively involved views, and therefore determines that all actively involved views should receive a particular sequence of sub-events. In other embodiments, even if touch sub-events were entirely confined to the area associated with one particular view, views higher in the hierarchy would still remain as actively involved views.

Event dispatcher module 274 dispatches the event information to an event recognizer (e.g., event recognizer 280). In embodiments including active event recognizer determination module 273, event dispatcher module 274 delivers the event information to an event recognizer determined by active event recognizer determination module 273. In some embodiments, event dispatcher module 274 stores in an event queue the event information, which is retrieved by a respective event receiver 282.

In some embodiments, operating system 226 includes event sorter 270. Alternatively, application 236-1 includes event sorter 270. In yet other embodiments, event sorter 270 is a stand-alone module, or a part of another module stored in memory 202, such as contact/motion module 230.

In some embodiments, application 236-1 includes a plurality of event handlers 290 and one or more application views 291, each of which includes instructions for handling touch events that occur within a respective view of the application's user interface. Each application view 291 of the application 236-1 includes one or more event recognizers 280. Typically, a respective application view 291 includes a plurality of event recognizers 280. In other embodiments, one or more of event recognizers 280 are part of a separate module, such as a user interface kit (not shown) or a higher level object from which application 236-1 inherits methods and other properties. In some embodiments, a respective event handler 290 includes one or more of: data updater 276, object updater 277, GUI updater 278, and/or event data 279 received from event sorter 270. Event handler 290 utilizes or calls data updater 276, object updater 277, or GUI updater 278 to update the application internal state 292. Alternatively, one or more of the application views 291 include one or more respective event handlers 290. Also, in some embodiments, one or more of data updater 276, object updater 277, and GUI updater 278 are included in a respective application view 291.

A respective event recognizer 280 receives event information (e.g., event data 279) from event sorter 270 and identifies an event from the event information. Event recognizer 280 includes event receiver 282 and event comparator 284. In some embodiments, event recognizer 280 also includes at least a subset of: metadata 283, and event delivery instructions 288 (which include sub-event delivery instructions).

Event receiver 282 receives event information from event sorter 270. The event information includes information about a sub-event, for example, a touch or a touch movement. Depending on the sub-event, the event information also includes additional information, such as location of the sub-event. When the sub-event concerns motion of a touch, the event information also includes speed and direction of the sub-event. In some embodiments, events include rotation of the device from one orientation to another (e.g., from a portrait orientation to a landscape orientation, or vice versa), and the event information includes corresponding information about the current orientation (also called device attitude) of the device.

Event comparator 284 compares the event information to predefined event or sub-event definitions and, based on the comparison, determines an event or sub event, or determines or updates the state of an event or sub-event. In some embodiments, event comparator 284 includes event definitions 286. Event definitions 286 contain definitions of events (e.g., predefined sequences of sub-events), for example, event 1 (287-1), event 2 (287-2), and others. In some embodiments, sub-events in an event (287) include, for example, touch begin, touch end, touch movement, touch cancellation, and multiple touching. In one example, the definition for event 1 (287-1) is a double tap on a displayed object. The double tap, for example, comprises a first touch (touch begin) on the displayed object for a predetermined phase, a first liftoff (touch end) for a predetermined phase, a second touch (touch begin) on the displayed object for a predetermined phase, and a second liftoff (touch end) for a predetermined phase. In another example, the definition for event 2 (287-2) is a dragging on a displayed object. The dragging, for example, comprises a touch (or contact) on the displayed object for a predetermined phase, a movement of the touch across touch-sensitive display 212, and liftoff of the touch (touch end). In some embodiments, the event also includes information for one or more associated event handlers 290.

In some embodiments, event definition 287 includes a definition of an event for a respective user-interface object. In some embodiments, event comparator 284 performs a hit test to determine which user-interface object is associated with a sub-event. For example, in an application view in which three user-interface objects are displayed on touch-sensitive display 212, when a touch is detected on touch-sensitive display 212, event comparator 284 performs a hit test to determine which of the three user-interface objects is associated with the touch (sub-event). If each displayed object is associated with a respective event handler 290, the event comparator uses the result of the hit test to determine which event handler 290 should be activated. For example, event comparator 284 selects an event handler associated with the sub-event and the object triggering the hit test.

In some embodiments, the definition for a respective event (287) also includes delayed actions that delay delivery of the event information until after it has been determined whether the sequence of sub-events does or does not correspond to the event recognizer's event type.

When a respective event recognizer 280 determines that the series of sub-events do not match any of the events in event definitions 286, the respective event recognizer 280 enters an event impossible, event failed, or event ended state, after which it disregards subsequent sub-events of the touch-based gesture. In this situation, other event recognizers, if any, that remain active for the hit view continue to track and process sub-events of an ongoing touch-based gesture.

In some embodiments, a respective event recognizer 280 includes metadata 283 with configurable properties, flags, and/or lists that indicate how the event delivery system should perform sub-event delivery to actively involved event recognizers. In some embodiments, metadata 283 includes configurable properties, flags, and/or lists that indicate how event recognizers interact, or are enabled to interact, with one another. In some embodiments, metadata 283 includes configurable properties, flags, and/or lists that indicate whether sub-events are delivered to varying levels in the view or programmatic hierarchy.

In some embodiments, a respective event recognizer 280 activates event handler 290 associated with an event when one or more particular sub-events of an event are recognized. In some embodiments, a respective event recognizer 280 delivers event information associated with the event to event handler 290. Activating an event handler 290 is distinct from sending (and deferred sending) sub-events to a respective hit view. In some embodiments, event recognizer 280 throws a flag associated with the recognized event, and event handler 290 associated with the flag catches the flag and performs a predefined process.

In some embodiments, event delivery instructions 288 include sub-event delivery instructions that deliver event information about a sub-event without activating an event handler. Instead, the sub-event delivery instructions deliver event information to event handlers associated with the series of sub-events or to actively involved views. Event handlers associated with the series of sub-events or with actively involved views receive the event information and perform a predetermined process.

In some embodiments, data updater 276 creates and updates data used in application 236-1. For example, data updater 276 updates the telephone number used in contacts module 237, or stores a video file used in video player module. In some embodiments, object updater 277 creates and updates objects used in application 236-1. For example, object updater 277 creates a new user-interface object or updates the position of a user-interface object. GUI updater 278 updates the GUI. For example, GUI updater 278 prepares display information and sends it to graphics module 232 for display on a touch-sensitive display.

In some embodiments, event handler(s) 290 includes or has access to data updater 276, object updater 277, and GUI updater 278. In some embodiments, data updater 276, object updater 277, and GUI updater 278 are included in a single module of a respective application 236-1 or application view 291. In other embodiments, they are included in two or more software modules.

It shall be understood that the foregoing discussion regarding event handling of user touches on touch-sensitive displays also applies to other forms of user inputs to operate multifunction devices 200 with input devices, not all of which are initiated on touch screens. For example, mouse movement and mouse button presses, optionally coordinated with single or multiple keyboard presses or holds; contact movements such as taps, drags, scrolls, etc. on touchpads; pen stylus inputs; movement of the device; oral instructions; detected eye movements; biometric inputs; and/or any combination thereof are optionally utilized as inputs corresponding to sub-events which define an event to be recognized.

FIG. 3 illustrates a portable multifunction device 200 having a touch screen 212 in accordance with some embodiments. The touch screen optionally displays one or more graphics within user interface (UI) 300. In this embodiment, as well as others described below, a user is enabled to select one or more of the graphics by making a gesture on the graphics, for example, with one or more fingers 302 (not drawn to scale in the figure) or one or more styluses 303 (not drawn to scale in the figure). In some embodiments, selection of one or more graphics occurs when the user breaks contact with the one or more graphics. In some embodiments, the gesture optionally includes one or more taps, one or more swipes (from left to right, right to left, upward and/or downward), and/or a rolling of a finger (from right to left, left to right, upward and/or downward) that has made contact with device 200. In some implementations or circumstances, inadvertent contact with a graphic does not select the graphic. For example, a swipe gesture that sweeps over an application icon optionally does not select the corresponding application when the gesture corresponding to selection is a tap.

Device 200 also includes one or more physical buttons, such as “home” or menu button 304. As described previously, menu button 304 is used to navigate to any application 236 in a set of applications that is executed on device 200. Alternatively, in some embodiments, the menu button is implemented as a soft key in a GUI displayed on touch screen 212.

In one embodiment, device 200 includes touch screen 212, menu button 304, push button 306 for powering the device on/off and locking the device, volume adjustment button(s) 308, subscriber identity module (SIM) card slot 310, headset jack 312, and docking/charging external port 224. Push button 306 is, optionally, used to turn the power on/off on the device by depressing the button and holding the button in the depressed state for a predefined time interval; to lock the device by depressing the button and releasing the button before the predefined time interval has elapsed; and/or to unlock the device or initiate an unlock process. In an alternative embodiment, device 200 also accepts verbal input for activation or deactivation of some functions through microphone 213. Device 200 also, optionally, includes one or more contact intensity sensors 265 for detecting intensity of contacts on touch screen 212 and/or one or more tactile output generators 267 for generating tactile outputs for a user of device 200.

FIG. 4 is a block diagram of an exemplary multifunction device with a display and a touch-sensitive surface in accordance with some embodiments. Device 400 need not be portable. In some embodiments, device 400 is a laptop computer, a desktop computer, a tablet computer, a multimedia player device, a navigation device, an educational device (such as a child's learning toy), a gaming system, or a control device (e.g., a home or industrial controller). Device 400 typically includes one or more processing units (CPUs) 410, one or more network or other communications interfaces 460, memory 470, and one or more communication buses 420 for interconnecting these components. Communication buses 420 optionally include circuitry (sometimes called a chipset) that interconnects and controls communications between system components. Device 400 includes input/output (I/O) interface 430 comprising display 440, which is typically a touch screen display. I/O interface 430 also optionally includes a keyboard and/or mouse (or other pointing device) 450 and touchpad 455, tactile output generator 457 for generating tactile outputs on device 400 (e.g., similar to tactile output generator(s) 267 described above with reference to FIG. 2A), sensors 459 (e.g., optical, acceleration, proximity, touch-sensitive, and/or contact intensity sensors similar to contact intensity sensor(s) 265 described above with reference to FIG. 2A). Memory 470 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM, or other random access solid state memory devices; and optionally includes non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory 470 optionally includes one or more storage devices remotely located from CPU(s) 410. In some embodiments, memory 470 stores programs, modules, and data structures analogous to the programs, modules, and data structures stored in memory 202 of portable multifunction device 200 (FIG. 2A), or a subset thereof. Furthermore, memory 470 optionally stores additional programs, modules, and data structures not present in memory 202 of portable multifunction device 200. For example, memory 470 of device 400 optionally stores drawing module 480, presentation module 482, word processing module 484, website creation module 486, disk authoring module 488, and/or spreadsheet module 490, while memory 202 of portable multifunction device 200 (FIG. 2A) optionally does not store these modules.

Each of the above-identified elements in FIG. 4 is, in some examples, stored in one or more of the previously mentioned memory devices. Each of the above-identified modules corresponds to a set of instructions for performing a function described above. The above-identified modules or programs (e.g., sets of instructions) need not be implemented as separate software programs, procedures, or modules, and thus various subsets of these modules are combined or otherwise rearranged in various embodiments. In some embodiments, memory 470 stores a subset of the modules and data structures identified above. Furthermore, memory 470 stores additional modules and data structures not described above.

Attention is now directed towards embodiments of user interfaces that can be implemented on, for example, portable multifunction device 200.

FIG. 5A illustrates an exemplary user interface for a menu of applications on portable multifunction device 200 in accordance with some embodiments. Similar user interfaces are implemented on device 400. In some embodiments, user interface 500 includes the following elements, or a subset or superset thereof:

Signal strength indicator(s) 502 for wireless communication(s), such as cellular and Wi-Fi signals;

-   -   Time 504;     -   Bluetooth indicator 505;     -   Battery status indicator 506;     -   Tray 508 with icons for frequently used applications, such as:         -   Icon 516 for telephone module 238, labeled “Phone,” which             optionally includes an indicator 514 of the number of missed             calls or voicemail messages;         -   Icon 518 for e-mail client module 240, labeled “Mail,” which             optionally includes an indicator 510 of the number of unread             e-mails;         -   Icon 520 for browser module 247, labeled “Browser;” and         -   Icon 522 for video and music player module 252, also             referred to as iPod (trademark of Apple Inc.) module 252,             labeled “iPod;” and     -   Icons for other applications, such as:         -   Icon 524 for IM module 241, labeled “Messages;”         -   Icon 526 for calendar module 248, labeled “Calendar;”         -   Icon 528 for image management module 244, labeled “Photos;”         -   Icon 530 for camera module 243, labeled “Camera;”         -   Icon 532 for online video module 255, labeled “Online             Video;”         -   Icon 534 for stocks widget 249-2, labeled “Stocks;”         -   Icon 536 for map module 254, labeled “Maps;”         -   Icon 538 for weather widget 249-1, labeled “Weather;”         -   Icon 540 for alarm clock widget 249-4, labeled “Clock;”         -   Icon 542 for workout support module 242, labeled “Workout             Support;”         -   Icon 544 for notes module 253, labeled “Notes;” and         -   Icon 546 for a settings application or module, labeled             “Settings,” which provides access to settings for device 200             and its various applications 236.

It should be noted that the icon labels illustrated in FIG. 5A are merely exemplary. For example, icon 522 for video and music player module 252 is optionally labeled “Music” or “Music Player.” Other labels are, optionally, used for various application icons. In some embodiments, a label for a respective application icon includes a name of an application corresponding to the respective application icon. In some embodiments, a label for a particular application icon is distinct from a name of an application corresponding to the particular application icon.

FIG. 5B illustrates an exemplary user interface on a device (e.g., device 400, FIG. 4) with a touch-sensitive surface 551 (e.g., a tablet or touchpad 455, FIG. 4) that is separate from the display 550 (e.g., touch screen display 212). Device 400 also, optionally, includes one or more contact intensity sensors (e.g., one or more of sensors 457) for detecting intensity of contacts on touch-sensitive surface 551 and/or one or more tactile output generators 459 for generating tactile outputs for a user of device 400.

Although some of the examples which follow will be given with reference to inputs on touch screen display 212 (where the touch-sensitive surface and the display are combined), in some embodiments, the device detects inputs on a touch-sensitive surface that is separate from the display, as shown in FIG. 5B. In some embodiments, the touch-sensitive surface (e.g., 551 in FIG. 5B) has a primary axis (e.g., 552 in FIG. 5B) that corresponds to a primary axis (e.g., 553 in FIG. 5B) on the display (e.g., 550). In accordance with these embodiments, the device detects contacts (e.g., 560 and 562 in FIG. 5B) with the touch-sensitive surface 551 at locations that correspond to respective locations on the display (e.g., in FIG. 5B, 560 corresponds to 568 and 562 corresponds to 570). In this way, user inputs (e.g., contacts 560 and 562, and movements thereof) detected by the device on the touch-sensitive surface (e.g., 551 in FIG. 5B) are used by the device to manipulate the user interface on the display (e.g., 550 in FIG. 5B) of the multifunction device when the touch-sensitive surface is separate from the display. It should be understood that similar methods are, optionally, used for other user interfaces described herein.

Additionally, while the following examples are given primarily with reference to finger inputs (e.g., finger contacts, finger tap gestures, finger swipe gestures), it should be understood that, in some embodiments, one or more of the finger inputs are replaced with input from another input device (e.g., a mouse-based input or stylus input). For example, a swipe gesture is, optionally, replaced with a mouse click (e.g., instead of a contact) followed by movement of the cursor along the path of the swipe (e.g., instead of movement of the contact). As another example, a tap gesture is, optionally, replaced with a mouse click while the cursor is located over the location of the tap gesture (e.g., instead of detection of the contact followed by ceasing to detect the contact). Similarly, when multiple user inputs are simultaneously detected, it should be understood that multiple computer mice are, optionally, used simultaneously, or a mouse and finger contacts are, optionally, used simultaneously.

3. System for Detecting Rotated or Angled Text in an Image Based on Global Text Geometry Estimations

FIG. 6 illustrates system 600 for detecting rotated or angled text in an image based on global text geometry estimations, according to some examples. In some examples, system 600 is implemented on one or more electronic devices (e.g., device 102, 200, 400, etc.) and the modules and functions of system 600 may be distributed in any manner between the devices. In some examples, system 600 is implemented using a client-server system, where one or more electronic devices (e.g., device 102, 200, 400, etc.) are implemented as client devices communicatively connected to a server system (e.g., server system 104). For example, the client devices can be communicatively connected to the server system via one or more networks (e.g., network(s) 106).

System 600 is implemented using hardware, software, or a combination of hardware and software to carry out the functions discussed herein. Further, system 600 is exemplary, and thus system 600 can have more or fewer components than shown, can combine two or more components, or can have a different configuration or arrangement of the components. Although the below discussion describes functions being performed at a single module of system 600, it is to be understood that such functions can be performed at other modules of system 600 and that such functions can be performed at more than one module of system 600.

To illustrate the examples discussed herein, system 600 and FIGS. 7A-F are discussed in parallel.

FIGS. 7A-F illustrate an image that contains angled text at various stages of processing by one or more modules of system 600, according to some examples.

System 600 includes text detection module 602. Text detection module 602 receives an image including a plurality of pixels (e.g., data representing an image having a plurality of pixels). For example, text detection module 602 can receive an image (e.g., picture), a frame/image of a recorded video, or a frame/image of a live video. In some examples, the image is captured by the device locally (e.g., via an optical sensor associated with the device (e.g., optical sensor 264)) and is subsequently provided to text detection module 602. In some examples, the image is received from a remote source (e.g., a server, a mobile device, etc.) and is subsequently provided to text detection module 602.

In some examples, the image that text detection module 602 receives contains text that is angled (e.g., relative to a top and/or bottom edge of the image). For example, in FIG. 7A, image 700 includes top edge 702, bottom edge 704, and angled text 706. As shown, angled text 706 is angled relative to top edge 702 and bottom edge 704 because angled text 706 is not parallel to either edge (e.g., angled text 706 does not have a 0 degree angle of rotation relative to bottom edge 704 or a 180 degree angle of rotation relative to top edge 706).

After receiving the image including a plurality of pixels, text detection module 602 determines, based on the image, one or more pixels of the plurality of pixels included in the image that contain text. In some examples, text detection module 602 applies one or more machine learning models to the received image to determine the one or more pixels that contain text. In some examples, the one or more machine learning models include one or more neural networks. For example, text detection module 602 can apply the Efficient and Accurate Scene Text Detector (“EAST”) neural network, the Character Region Awareness for Text Detection (“CRAFT”) neural network, and/or any other related text detection neural network to the image.

In some examples, determining the one or more pixels that contain text includes text detection module 602 determining (e.g., using one or more machine learning models) a text probability for each pixel of the plurality of pixels included in the image. A pixel's text probability represents a probability that the pixel contains text. In these examples, text detection module 602 determines whether a pixel does or does not contain text based on whether or not the pixel's text probability satisfies a predetermined threshold probability (e.g., 50%, 60%, 80%, etc.). For example, if the predetermined threshold probability is 80% and text detection module 602 determines that a pixel has a text probability of 90%, then text detection module 602 will determine that the pixel contains text. As another example, if the predetermined threshold probability is 80% and text detection module 602 determines that a pixel has a text probability of 70%, then text detection module 602 will determine that the pixel does not contain text.

In some examples, after determining the one or more pixels that contain text, text detection module 602 generates a binary text score map. A binary text score map indicates the pixels that do and do not contain text in the received image. For example, FIG. 7B illustrates binary text score map 708 corresponding to image 700. In FIG. 7B, the pixels of image 700 that contain text (e.g., pixels 710) are colored white whereas the pixels that do not contain text (e.g., pixels 712) are colored black. In some examples, text detection module 602 generates the binary text score map using the one or more machine learning models that text detection module 602 uses to determine the one or more pixels that contain text.

In some examples, text detection module 602 determines a local text angle for each pixel that contains text in the received image. A pixel's local text angle represents an angle of rotation (e.g., counterclockwise rotation) of a bounding box that encloses the pixel (described in greater detail below with reference to bounding box module 610) relative to a bottom edge of the received image (e.g., bottom edge 704 of image 700). In some examples, text detection module 602 determines a local text angle for each pixel that contains text using the one or more machine learning models that text detection module 602 uses to determine the one or more pixels that contain text. In other examples, text detection module 602 determines a local text angle for each pixel that contains text by applying one or more feature extraction algorithms (e.g., Hough transform, Generalized Hough transform, blob extraction algorithms, etc.) to data indicating the pixels that contain text (e.g., data indicating a location of each pixel that contains text within the received image).

In some examples, text detection module 602 determines four bounding box edge distances for each pixel that contains text. A pixel's four bounding box edge distances represent the pixel's distance from each of the four edges of a bounding box that encloses the pixel (described in greater detail below with reference to bounding box module 610). In some examples, text detection module 602 determines four bounding box edge distances for each pixel that contains text using the one or more machine learning models that text detection module 602 uses to determine the one or more pixels that contain text.

After text detection module 602 determines the one or more pixels of the received image that contain text, text detection module 602 provides data indicating the pixels that contain text to component module 604 and bounding box module 610 (described in greater detail below). For example, the data indicating the pixels that contain text can be a dataset that includes a location of each pixel within the image (e.g., coordinate location, pixel number, etc.) and an indication of whether each pixel does or does not contain text. In some examples, text detection module 602 additionally provides data indicating a local text angle and/or four bounding box edge distances for each pixel that contains text to component module 604 and bounding box module 610. For example, the local text angle and/or four bounding box edge distances for each pixel that contains text can be included in the dataset mentioned above. In some examples, text detection module 602 additionally provides a binary text score map corresponding to the received image to component module 604 and/or bounding box module 610.

System 600 includes component module 604. After receiving the data indicating the pixels that contain text, component module 604 identifies a plurality of components in the received image based on the pixels that contain text (e.g., as indicated by the received data and/or a received binary text score map). A component represents a grouping of connected, adjacent, and/or neighboring pixels that contain text (e.g., two or more connected, adjacent, and/or neighboring pixels that contain text). In some examples, an identified component can represent one or more characters (e.g., letters, punctuations, symbols, etc.), words, and/or text strings within a received image. For example, returning to FIG. 7B, binary text score map 708 includes several components, including components 714 and 716.

In some examples, component module 604 identifies the plurality of components in the received image by applying one or more machine learning models and/or one or more algorithms to the data indicating the pixels that contain text within the received image and/or to the binary text score map corresponding to the image. For example, component module 604 can identify the plurality of components in the received text message by applying a seed fill algorithm (also known as a flood fill algorithm) to the data indicating the pixels that contain text and/or the binary text score map.

Component module 604 includes filter module 606. After identifying the plurality of components in the received image, component module 604 provides data indicating the plurality of components to filter module 606. For example, the data indicating the plurality of components can be a dataset that includes a location of each component within the image (e.g., a coordinate location, location of pixels included in the component, etc.) and a number of pixels that contain text within each component. Additionally, for example, the above data set can also include a local text angle and/or four bounding box edge distances for each pixel that contains text of the plurality of components.

After receiving the data indicating the plurality of components in the received image, filter module 606 determines a subset of components based on the plurality of components. In some examples, filter module 606 determines the subset of components by determining whether each component of the plurality of components includes a predetermined minimum number of pixels that contain text. In these examples, if a component includes at least the predetermined minimum number of pixels that contain text, filter module 606 includes the component in the subset of components. However, if a component does not include at least the predetermined minimum number of pixels, filter module 606 filters out the component by not including it in the subset of components. For example, if the predetermined minimum number of pixels that contain text is 100 and a component of the plurality of components only includes 10 pixels that contain text, filter module 606 will not include the component in the subset of components.

After filtering the plurality of components and determining the subset of components, filter module 606 provides data indicating the subset of components to component module 604. For example, the data indicating the subset of components can be the same as the data indicating the plurality of components described above except that the data indicating the subset of components would not include data for the one or more components of the plurality of components that are not included in the subset of components.

In some examples, after receiving the data indicating the subset of components from filter module 606, component module 604 generates a filtered binary text score map based on a binary text score map (e.g., received from text detection module 602) and the data indicating the subset of components. For example, FIG. 7C illustrates filtered binary text score map 718 corresponding to binary text score map 708. In FIG. 7C, filtered binary text score map 718 includes components that filter module 606 included in a subset of components, such as component 716 from binary text score map 708. However, filtered binary text score map 718 does not include component 714 from binary text score map 708 because filter module 606 did not include component 714 in the subset of components (e.g., because component 714 did not include a predetermined minimum number of pixels that contain text).

After receiving the data indicating the subset of components from filter module 606, component module 604 provides the data indicating the subset of components to global text geometry module 608 (described in greater detail below). In some examples, component module 604 additionally provides a filtered binary text score map to global text geometry module 608.

System 600 includes global text geometry module 608. After receiving the data indicating the subset of components from filter module 606, global text geometry module 608 determines one or more candidate text angles based on the pixels that contain text of the subset of components (e.g., based on the received pixel data and/or a received filtered binary text score map). Each determined candidate text angle is associated with a plurality of pixels (of the subset of components) that contain text. For example, a single candidate text angle can be associated with a plurality of pixels in a single component of the subset of components and/or a plurality of pixels in various components of the subset of components. In other words, the pixels that a candidate text angle can be associated with are not limited pixels belonging to the same component.

In some examples, global text geometry module 608 determines the one or more candidate text angles by applying a feature extraction algorithm (e.g., Hough transform, Generalized Hough transform, blob extraction algorithms, etc.) to the data indicating the subset of components received from filter module 606 and/or the filtered binary text score map. Then, based on the application of the feature extraction algorithm, global text geometry module 608 determines a text angle for each pixel that contains text of the subset of components. Each text angle is an angle of rotation (e.g., counterclockwise rotation) relative to the bottom edge of the received image (e.g., bottom edge 704 of image 700) that represents a global text angle estimation for text within the received image. Further, each text angle is a potential candidate text angle. Note, in some examples, applying a feature extraction algorithm to data indicating the subset of components instead of data indicating the plurality of components (i.e., applying the feature extraction algorithm to the filtered data) reduces noise generated by the application of the Hough transformation and allows global text geometry module 608 to more accurately determine a text angle for each pixel that contains text of the subset of components.

After determining a text angle for each pixel that contains text of the subset of components, global text geometry module 608 determines the one or more candidate text angles based on the determined text angles. Each candidate text angle is a potential global text angle. In some examples, global text geometry module 608 determines the one or more candidate text angles by generating a transformation matrix (e.g., a Cartesian coordinate system) based on the determined text angles and their corresponding pixels. For example, global text geometry module 608 can generate a transformation matrix wherein the x-axis represents text angles (e.g., ranging from 0 to 360 degrees) and the y-axis represents pixel location within the image (e.g., distance from a pixel to a certain corner of the image). Then, global text geometry module 608 determines one or more local maxima of the transformation matrix. Each local maxima represents a candidate text angle. For example, global text geometry module 608 can determine that a transformation matrix contains three local maxima corresponding to text angles of 84 degrees, 85 degrees, and 86 degrees. Thus, the candidate text angles in this example are 84 degrees, 85 degrees, and 86 degrees. Further, as mentioned above, each candidate text angle is associated with a plurality of pixels that contain text (because each pixel of the plurality of pixels associated with a candidate text angle corresponds to the same determined text angle).

After determining the one or more candidate text angles, global text geometry module 608 determines a global text angle based on the determined one or more candidate text angles. A global text angle represents the single determined text angle that is most commonly shared among angled text within an image (e.g., angled text 706 of image 700). In other words, a global text angle represents an angle of rotation that can be associated with all angled text within an image (relative to a bottom edge of the image). For example, FIG. 7D illustrates global text angle 720, which represents a single angle of rotation to be used for all angled components within filtered binary text score map 718 (e.g., representing one or more angled text strings of image 700). Determining a global text angle allows a text detection system to account for an angle of rotation that can be associated with all angled text within an image when determining text bounding boxes (as will be described in greater detail below) instead of relying on local text angles of neighboring pixels within the image (which may be inconsistent with local text angles of pixels in other parts of the image) to account for the angle of rotation of angled text in the image. In this manner, determining a global text angle allows a text detection system to more accurately and consistently detect angled text within an image (e.g., more accurately and consistently enclose angled text with bounding boxes).

In some examples, global text geometry module 608 determines the global text angle by determining a number of pixels that contain text that are associated with each candidate text angle. For example, returning to the example discussed in the previous paragraph, global text geometry module 608 can determine that the 84 degree, 85 degree, and 86 degree candidate text angles are associated with 94 pixels, 425 pixels, and 40 pixels, respectively. After determining a number of pixels that are associated with each candidate text angle, global text geometry module 608 determines the global text angle based on the number of pixels associated with each candidate text angle. In some examples, the global text angle is the candidate text angle that is associated with the most pixels that contain text. Thus, in the example above, global text geometry module 608 would determine that the 85 degree candidate text angle is the global text angle because 85 degree candidate text angle is associated with the greatest number of pixels (compared to the other two candidate text angles).

After determining a global text angle, global text geometry module 608 provides data indicating the determined global text angle to bounding box module 610 (described in greater detail below). Bounding box module 610 then determines a plurality of bounding boxes based on the determined global text angle.

In some examples, prior to providing data indicating the global text angle to bounding box module 610, global text geometry module 608 determines whether the plurality of pixels associated with the global text angle satisfy a predetermined condition. In some examples, the predetermined condition includes a requirement that the plurality of pixels associated with the global text angle outnumber or equal a threshold number of pixels. In some examples, the threshold number of pixels is a predetermined minimum number of pixels. In some examples, the predetermined minimum number of pixels is based on a total number of pixels that contain text within the received image (e.g., image 700).

In some examples, the threshold number of pixels is equal to a sum of all pixels associated with the one or more candidate text angles multiplied by a predetermined threshold constant. For example, returning to the example discussed above, global text geometry module 608 will (1) add the number of pixels associated with the 84 degree, 85 degree, and 86 degree candidate text angles to determine a total number of pixels (e.g., 94 pixels+425 pixels+40 pixels=559 total pixels), (2) multiply the total number of pixels by a predetermined threshold constant to determine the threshold number of pixels (e.g., 559×0.75=419.25), and (3) determine whether the 425 pixels associated with the determined 85 degree global text angle outnumber or equal the threshold number of pixels. In this example, global text geometry module 608 would determine that the 425 pixels associated with the 85 degree global text angle do satisfy the predetermined condition because 425 pixels outnumbers 419.25 pixels.

In accordance with a determination that the plurality of pixels associated with the determined global text angle satisfy the predetermined condition, global text geometry module 608 provides data indicating the determined global text angle to bounding box module 610 (described in greater detail below) and bounding box module 610 determines a plurality of bounding boxes based on the determined global text angle.

In accordance with a determination that the plurality of pixels associated with the determined global text angle do not satisfy the predetermined condition, global text geometry module 608 does not provide data indicating the determined global text angle to bounding box module 610. In this instance, bounding box module 610 determines a plurality of bounding boxes based on data received from text detection module 602. For example, bounding box module 610 can determine the plurality of bounding boxes based on data indicating the pixels that contain text within the received image, data indicating a local text angle for each pixel within the received image, data indicating four bounding box edge distances for each pixel within the received image, and/or a binary text score map corresponding to the received image. In this manner, global text geometry module 608 ensures that the determined global text angle is not provided to bounding box module 610 if the determined global text angle cannot be applied to all components/text in an image. In other words, this step confirms that the image includes components/text having a diverse range of text angles instead of a single global text angle, or two or more text angles that are nearly the same (e.g., with the text angles only differing by 1 or 2 degrees)).

In some examples, prior to providing data indicating the global text angle to bounding box module 610, global text geometry module 608 determines whether a predetermined threshold number of pixels of the plurality of pixels associated with the global text angle are located in a specific region of the image (e.g., top half of the image, bottom half of the image, bottom right quarter of the image, etc.). For example, the predetermined threshold number of pixels can be a minimum percentage of the pixels associated with the global text angle (e.g., at least 75% of the plurality of pixels) or a minimum percentage of all pixels that contain text in the specific region (e.g., pixels of the plurality of pixels make up at least 50% of pixels that contain text in the specific region).

In accordance with a determination that a predetermined threshold number of pixels of the plurality of pixels associated with the global text angle are located in a specific region of the image, global text geometry module 608 determines whether a predetermined threshold number of pixels associated with a candidate text angle of the one or more determined candidate text angles (not including the candidate text angle corresponding to the global text angle) are located in another specific region of the image. For example, the predetermined threshold number of pixels can be a minimum percentage of the pixels associated with the candidate text angle (e.g., at least 75% of the plurality of pixels associated with the candidate text angle) or a minimum percentage of all pixels that contain text in the other specific region (e.g., pixels of the plurality of pixels make up at least 50% of pixels that contain text in the specific region).

In response to determining that a predetermined threshold number of pixels of the plurality of pixels associated with a candidate text angle are located in another specific region of the image, global text geometry module 608 determines that the candidate text angle represents an additional global text angle. In this manner, global text geometry module 608 can, for example, determine a global text angle associated with pixels that contain text located in a top half of an image as well as an additional global text angle associated with pixels that contain text in a bottom half of an image. Note, in examples where there are more than one global text angle, the global text angles can be collectively referred to as regional text angles. After determining one or more additional global text angles, global text geometry module 608 provides data indicating the determined global text angle and the one or more additional global text angles to bounding box module 610 (described in greater detail below) and bounding box module 610 determines a plurality of bounding boxes corresponding to each of the global text angles.

In response to determining that none of the one or more candidate text angles are associated with a plurality of pixels having a threshold number of pixels located in another specific region of the image, global text geometry module 608 does not provide data indicating the determined global text angle to bounding box module 610. In this instance, bounding box module 610 determines a plurality of bounding boxes based on data received from text detection module 602. For example, bounding box module 610 can determine the plurality of bounding boxes based on data indicating the pixels that contain text within the received image, data indicating a local text angle for each pixel within the received image, data indicating four bounding box edge distances for each pixel within the received image, and/or a binary text score map corresponding to the received image.

In accordance with a determination that a threshold number of pixels of the plurality of pixels associated with the global text angle are not located in a specific region of the image (e.g., because the plurality of pixels are evenly distributed throughout the image), global text geometry module 608 provides data indicating the determined global text angle to bounding box module 610 (described in greater detail below) and bounding box module 610 determines a plurality of bounding boxes based on the determined global text angle.

In some examples, instead of determining regional text angles by processing an entire image to determine a single global text angle and subsequently determining whether there are any additional global text angles (as described above), system 600 divides a received image into two or more regions and subsequently processes each region as if each region were an entire image to determine a regional text angle for one or more of the regions (i.e., a global text angle for each of the one or more regions). For example, text detection module 602 can divide an image into one or more regions based on a text density prediction (e.g., using one or more machine learning models). Then, text detection module 602, component module 604, filter module 606, and global text geometry module 608 can process each of the one or more regions as described above to determine a regional text angle for at least one of the one or more regions. After determining one or more regional text angles in this fashion, global text geometry module 608 provides data indicating the determined regional text angles to bounding box module 610 (described in greater detail below) and bounding box module 610 determines a plurality of bounding boxes corresponding to each of the regional text angles.

System 600 includes bounding box module 610. Bounding box module 610 determines one or bounding boxes based on data received from text detection module 602 and/or global text geometry module 608. A bounding box indicates detected text in an image by enclosing a component (e.g., of the plurality of components) representing detected text. For example, a bounding box can be a square, rectangle, or quadrangle that encloses a component representing one or more characters (e.g., letters, numbers, punctuations, symbols, etc.), one or more words, and/or one or more text strings. In some examples, bounding box module 610 applies one or more machine learning algorithms to data received from text detection module 602 and/or global text geometry module 608 to determine the one or more bounding boxes. For example, bounding box module 610 can apply the same one or more machine learning algorithms that text detection module 602 uses to determine the plurality of pixels that contain text.

After receiving data indicating a determined global text angle from global text geometry module 608, bounding box module 610 determines a plurality of bounding boxes based on the determined global text angle. In some examples, each bounding box of the plurality of bounding boxes encloses one or more components of the subset of components determined by filter module 606. In other examples, each bounding box of the plurality of bounding boxes encloses one or more components of the plurality of components determined by component module 604. In other words, in these examples, one or more of the components that are filtered out by filter module 606 and one or more of the components that are not filtered out by filter module 606 (e.g., one or more components of the subset of components) are enclosed by a bounding box of the plurality of bounding boxes.

In some examples, after receiving data indicating a determined global text angle from global text geometry module 608, bounding box module 610 determines the plurality of bounding boxes based on the determined global text angle and data received from text detection module 602 (e.g., data indicating pixels that contain text, a binary text score map, data indicating a local text angle for each pixel that contains text, data indicating four bounding box edge distances for each pixel that contains text, etc.). In some examples, determining the plurality of bounding boxes based on the determined global text angle and data received from text detection module 602 includes bounding box module 610 determining a plurality of preliminary bounding boxes based on the data received from text detection module 602. For example, bounding box module 610 can determine the plurality of preliminary bounding boxes based on a binary text score map and data indicating a local text angle for each pixel that contains text (e.g., using one or more machine learning models).

After bounding box module 610 determines the plurality of preliminary bounding boxes, bounding box module 610 determines the plurality of bounding boxes by refining one or more bounding boxes of the plurality of preliminary bounding boxes based on the determined global text angle. For example, refining one or more bounding boxes of the plurality of preliminary bounding boxes based on the determined global text angle can include realigning a position of one or more bounding boxes of the plurality of preliminary bounding boxes, realigning an angle of one or more bounding boxes of the plurality of preliminary bounding boxes (e.g., relative to a bottom edge of an image), adjusting one or more dimensions (e.g., length and/or width) of one or more bounding boxes of the plurality of preliminary bounding boxes, removing one or more bounding boxes of the plurality of preliminary bounding boxes, and/or adding one or more bounding boxes to the plurality of preliminary bounding boxes.

Determining bounding boxes based on local text geometry estimations (e.g., data indicating pixels that contain text, a binary text score map, data indicating a local text angle for each pixel that contains text, and/or data indicating four bounding box edge distances for each pixel that contains text) can result in inaccurate or suboptimal text detection when text in an image is rotated or angled. Thus, realigning and/or adjusting one or more preliminary bounding boxes (which, as described above, are determined based on local geometry estimations) using a determined global text angle allows bounding box module 610 to more consistently and accurately enclose components representing detected text with bounding boxes when the detected text is rotated or angled (e.g., relative to a bottom edge of an image). In this manner, refining one or more preliminary bounding boxes based on a determined global text angle improves the detection of rotated or angled text in an image, as the rotated or angled text is more accurately and consistently indicated by bounding boxes.

For example, FIG. 7E illustrates image 700 with angled text 706 being enclosed by a plurality of preliminary bounding boxes 722, such as preliminary bounding box 724 and preliminary bounding box 726. Bounding box module 610 determined the plurality of preliminary bounding boxes 722 based on local geometry estimations (e.g., based only on data received from text detection module 602). As shown, many bounding boxes of preliminary bounding boxes 722 do not accurately and/or consistently enclose angled text 706. For example, there are several preliminary bounding boxes 722 that do not fully enclose corresponding angled text 706 (e.g., one or more letters of a text are outside of preliminary bounding box 724), have dimensions that are inconsistent with the dimensions and/or location of angled text 706 that is meant to be enclosed (e.g., preliminary bounding box 726), and/or intrude upon neighboring bounding boxes of preliminary bounding boxes 722 and/or neighboring angled text 706 (e.g., preliminary bounding box 726 encloses neighboring bounding boxes of preliminary bounding boxes 722 and their corresponding angled text 706).

However, refining one or more bounding boxes of preliminary bounding boxes 722 based on a determined global text angle results in more accurate and consistent enclosure of angled text 706. For example, FIG. 7F illustrates image 700 with angled text 706 being enclosed by a plurality of refined bounding boxes 728, such as refined bounding box 730 and refined bounding box 732. Bounding box module 610 determined the plurality of refined bounding boxes 724 by refining one or more bounding boxes of preliminary bounding boxes 722 based on global text angle 720 (discussed above with reference to FIG. 7D). More specifically, bounding box module 610 determined refined bounding box 730 and refined bounding box 732 by refining preliminary bounding box 724 and preliminary bounding box 726 (discussed above with reference to FIG. 7E), respectively.

As shown, the position, alignment (e.g., angle of rotation relative to a bottom edge of image 700), and/or dimensions of many of the bounding boxes of preliminary bounding boxes 722 from FIG. 7E have been corrected/improved based on global text angle 720. For example, the dimensions of preliminary bounding box 724 were refined such that refined bounding box 730 now fully encloses the portions of angled text 706 that were previously left out of preliminary bounding box 724. Further, the dimensions and angle of rotation of preliminary bounding box 726 were refined such that the dimensions of refined bounding box 732 are now more consistent with the dimensions of the portions of angled text 706 that are enclosed by refined bounding box 732, and such that refined bounding box 732 no longer intrudes into neighboring bounding boxes of refined bounding boxes 728 or their corresponding angled text 706 (e.g., refined bounding box 732 no longer encloses and/or partially encloses neighboring bounding boxes).

Returning to FIG. 6, in the examples where bounding box module 610 receives data from text detection module 602 but does not receive data indicating a global text angle from global text geometry module 608 (e.g., because the plurality of pixels associated with a global text angle failed to satisfy a predetermined condition), bounding box module 610 determines the plurality of bounding boxes based on data received from text detection module 602 (e.g., data indicating pixels that contain text, a binary text score map, data indicating a local text angle for each pixel that contains text, data indicating four bounding box edge distances for each pixel that contains text, etc.). In some examples, bounding box module 610 determines the plurality of bounding boxes based on data received from text detection module 602 in the same manner that bounding box module 610 determines a plurality of preliminary bounding boxes (described above in greater detail). In some examples, the plurality of bounding boxes determined based on data received from text detection module 602 are the same as the plurality of preliminary bounding boxes.

In the examples where bounding box module 610 receives (from global text geometry module 608) data indicating the determined global text angle and one or more additional global text angles (collectively referred to as regional text angles), bounding box module 610 determines a plurality of bounding boxes for each determined regional text angle (with each plurality of bounding boxes being determined based on their corresponding regional text angle). For example, bounding box module 610 can determine a first plurality of bounding boxes enclosing text located in a top half of an image based on a first regional text angle and a second plurality of bounding boxes enclosing text located in a bottom half of the same image based on a second regional text angle.

In some examples, bounding box module 610 determines each of the plurality of bounding boxes based on their corresponding regional text angles and data received from text detection module 602 (e.g., data indicating pixels that contain text, a binary text score map, data indicating a local text angle for each pixel that contains text, data indicating four bounding box edge distances for each pixel that contains text, etc.). In some examples, determining each of the plurality of bounding boxes based on their corresponding regional text angles and data received from text detection module 602 includes bounding box module 610 determining a plurality of preliminary bounding boxes based on the data received from text detection module 602. For example, bounding box module 610 can determine the plurality of preliminary bounding boxes based on a binary text score map and data indicating a local text angle for each pixel that contains text (e.g., using one or more machine learning models).

After bounding box module 610 determines the plurality of preliminary bounding boxes, bounding box module 610 determines the plurality of bounding boxes for each regional text angle by refining one or more bounding boxes of the plurality of preliminary bounding boxes based the determined regional text angles. Specifically, bounding box module 610 refines the one or more preliminary bounding boxes based on a regional text angle that corresponds to a location of the one or more preliminary bounding boxes within the image (e.g., based on a regional text angle that corresponds to a region of the image in which the one or more preliminary bounding boxes are located). For example, bounding box module 610 can determine a first plurality of bounding boxes by refining one or more preliminary bounding boxes located in a top half of an image based on a first regional text angle, and a second plurality of bounding boxes by refining one or more preliminary bounding boxes located in a bottom half of the same image based on a second regional text angle.

In some examples, bounding box module 610 refines one or more bounding boxes of a plurality of preliminary bounding boxes based on a regional text angle in the same manner that bounding box module refines one or more bounding boxes of a plurality of preliminary bounding boxes based on a global text angle (described in greater detail above). For example, refining one or more bounding boxes of the plurality of preliminary bounding boxes based on a regional text angle can include realigning a position of one or more bounding boxes of the plurality of preliminary bounding boxes, realigning an angle of one or more bounding boxes of the plurality of preliminary bounding boxes (e.g., relative to a bottom edge of an image), adjusting one or more dimensions (e.g., length and/or width) of one or more bounding boxes of the plurality of preliminary bounding boxes, removing one or more bounding boxes of the plurality of preliminary bounding boxes, and/or adding one or more bounding boxes to the plurality of preliminary bounding boxes.

In some examples, after bounding box module 610 determines a plurality of bounding boxes (e.g., based on a global text angle, data received from text detection module 602, and/or two or more regional text angles), bounding box module 610 provides data indicating the plurality of bounding boxes (e.g., refined bounding boxes 728) to a display module of an electronic device (e.g., graphics module 232) so that the electronic device renders and displays the plurality of bounding boxes as overlaying the received image (e.g., image 700), and enclosing text within the received image, on a display of the electronic device (e.g., touch-sensitive display 212) and/or on another display that is communicatively-connected to the electronic device. For example, a plurality of bounding boxes for a top left quarter of an image and a plurality of boxes for a bottom right quarter of the image can be concurrently displayed on a display as overlaying the image.

In some examples, providing data indicating the plurality of bounding boxes to a display module of an electronic device includes transmitting the data indicating the plurality of bounding boxes from a first electronic device that determines the plurality of bounding boxes (e.g., server system 104) to a second electronic device (e.g., device 102) so that a display module of the second electronic device renders and displays the plurality of bounding boxes as overlaying the received image, and enclosing text within the received image, on a display of the second electronic device and/or on another display that is communicatively-connected to the second electronic device.

FIGS. 8A-C illustrate a flow diagram of process 800 for detecting rotated or angled text in an image based on global text geometry estimations, according to various examples. Process 800 is performed, for example, using one or more electronic devices implementing a text detection system. In some examples, process 800 is performed using a client-server system (e.g., system 100), and the blocks of process 800 are divided up in any manner between the server (e.g., server system 104) and a client device (e.g., device 102). In other examples, the blocks of process 800 are divided up between the server and multiple client devices (e.g., a mobile phone and a smart watch). Thus, while portions of process 800 are described herein as being performed by particular devices of a client-server system, it will be appreciated that process 800 is not so limited. In other examples, process 800 is performed using only a client device (e.g., user device 102) or only multiple client devices. In process 800, some blocks are, optionally, combined, the order of some blocks is, optionally, changed, and some blocks are, optionally, omitted. In some examples, additional steps may be performed in combination with the process 800.

At block 802, an image (e.g., image data having a plurality of pixels) is received (e.g., by text detection module 602), the image including a plurality of pixels.

At block 804, one or more pixels of the plurality of pixels included in the image that contain text are determined (e.g., by text detection module 602) based on the image. In some examples, the one or more pixels of the plurality of pixels that contain text are determined using a text detection neural network.

At block 806, in some examples, a text detection neural network is used (e.g., by text detection module 602) to determine a text probability for each pixel of the plurality of pixels. In some examples, a pixel of the plurality of pixels contains text (e.g., at step 804) if the text probability corresponding to the pixel satisfies a predetermined threshold.

At block 808, in some examples, a local text angle for each pixel that contains text is determined (e.g., by text detection module 602) based on the image.

At block 810, a plurality of components in the image are identified (e.g., by component module 604) based on the one or more pixels that contain text. In some examples, each component of the plurality of components represents a grouping of pixels that contain text. In some examples, the plurality of components are identified using a seed fill algorithm, as shown in block 812.

At block 814, a subset of components is determined (e.g., by filter module 606) based on the plurality of components. In some examples, the subset of components includes one or more components of the plurality of components that include a predetermined minimum number of pixels.

At block 816, one or more candidate text angles are determined (e.g., by global text geometry module 608) based on the pixels that contain text of the subset of components. In some examples, each candidate text angle of the one or more candidate text angles is associated with a plurality of pixels that contain text. In some examples, determining the one or more candidate text angles based on the pixels that contain text of the subset of components includes: determining a text angle for each pixel of the pixels that contain text of the subset of components using a transform, as shown at block 818; generating a transformation matrix based on the determined text angles, as shown at block 820; and determining the one or more candidate text angles based on one or more local maxima of the transformation matrix, as shown at block 822.

At block 824, a global text angle is determined (e.g., by global text geometry module 608) based on the one or more candidate text angles. In some examples, the global text angle represents the candidate text angle of the one or more candidate text angles that is associated with a greatest number of pixels that contain text of the subset of components.

At block 826, in some examples, prior to determining the first plurality of bounding boxes (e.g., at block 830), it is determined (e.g., by global text geometry module 608) whether the plurality of pixels associated with the global text angle satisfy a predetermined condition. In some examples, the predetermined condition includes a requirement that the plurality of pixels associated with the global text angle outnumber or equal a threshold number of pixels. In some examples, the threshold number of pixels is equal to a sum of all pixels associated with the one or more candidate text angles multiplied by a predetermined threshold constant.

At block 828, in some examples, in accordance with a determination that the plurality of pixels associated with the global text angle satisfy the predetermined condition (e.g., at block 826), the first plurality of bounding boxes are determined (e.g., by bounding box module 608) based on the global text angle.

At block 830, a first plurality of bounding boxes is determined (e.g., by bounding box module 610) based on the global text angle. In some examples, each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components.

In some examples, determining the first plurality of bounding boxes based on the global text angle includes realigning a position of one or more preliminary bounding boxes based on the global text angle, as shown in block 832. In some examples, determining the first plurality of bounding boxes based on the global text angle comprises adjusting one or more dimensions of one or more preliminary bounding boxes based on the global text angle, as shown in block 834. In some examples, the one or more preliminary bounding boxes are determined (e.g., by bounding box module 610) using a text detection neural network.

At block 836, in some examples, in accordance with a determination that the plurality of pixels associated with the global text angle do not satisfy the predetermined condition (e.g., at block 826), a second plurality of bounding boxes is determined (e.g., by bounding box module 610) based on the local text angle for each pixel that contains text of the plurality of components (e.g., determined at step 808). In some examples, each bounding box of the second plurality of bounding boxes encloses a component of the plurality of components.

At block 838, in some examples, the image (e.g., received at block 802) is displayed (e.g., by graphics module 232) at a display (e.g., at touch-sensitive display 212). At block 840, in some examples, the first plurality of bounding boxes (e.g., determined at block 826) are displayed at the display as overlaying the displayed image.

At block 842, in some examples, it is determined (e.g., by global text geometry module 608) whether a predetermined threshold number of pixels of the plurality of pixels associated with the global text angle (e.g., determined at block 824) are located in a first region of the image. In some examples, the first region of the image includes a top half of the image (e.g., received at block 802).

At block 844, in some examples, in accordance with a determination that a predetermined threshold number of pixels of the plurality of pixels associated with the global text angle are located in the first region of the image (e.g., at block 842), it is determined (e.g., by global text geometry module 608) whether a predetermined threshold number of pixels of the plurality of pixels associated with a candidate text angle of the one or more candidate text angles (e.g., determined at block 816) are located in a second region of the image. In some examples, the second region of the image includes a bottom half of the image (e.g., received at block 802).

At block 846, in some examples, in response to determining that a predetermined threshold number of pixels of the plurality of pixels associated with the candidate text angle of the one or more candidate text angles are located in the second region of the image (e.g., at block 844), a second global text angle is determined (e.g., by global text geometry module 608) based on the candidate text angle of the one or more candidate text angles.

At block 848, in some examples, a third plurality of bounding boxes is determined (e.g., by bounding box module 610) based on the second global text angle (e.g., determined at block 846). In some examples, each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components located in the first region, and each bounding box of the third plurality of bounding boxes encloses a component of the plurality of components located in the second region.

The operations described above with reference to FIG. 8 are optionally implemented by components depicted in FIGS. 1-4 and 6. For example, the operations of process 800 may be implemented by system 600. It would be clear to a person having ordinary skill in the art how other processes are implemented based on the components depicted in FIGS. 1-4 and 6.

In accordance with some implementations, a computer-readable storage medium (e.g., a non-transitory computer readable storage medium) is provided, the computer-readable storage medium storing one or more programs for execution by one or more processors of an electronic device, the one or more programs including instructions for performing any of the methods or processes described herein.

In accordance with some implementations, an electronic device (e.g., a portable electronic device) is provided that comprises means for performing any of the methods or processes described herein.

In accordance with some implementations, an electronic device (e.g., a portable electronic device) is provided that comprises a processing unit configured to perform any of the methods or processes described herein.

In accordance with some implementations, an electronic device (e.g., a portable electronic device) is provided that comprises one or more processors and memory storing one or more programs for execution by the one or more processors, the one or more programs including instructions for performing any of the methods or processes described herein.

The foregoing description, for purpose of explanation, has been described with reference to specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain the principles of the techniques and their practical applications. Others skilled in the art are thereby enabled to best utilize the techniques and various embodiments with various modifications as are suited to the particular use contemplated.

Although the disclosure and examples have been fully described with reference to the accompanying drawings, it is to be noted that various changes and modifications will become apparent to those skilled in the art. Such changes and modifications are to be understood as being included within the scope of the disclosure and examples as defined by the claims. 

1-23. (canceled)
 24. A non-transitory computer-readable storage medium storing one or more programs, the one or more programs including instructions, which when executed by one or more processors of an electronic device, cause the electronic device to: receive an image including a plurality of pixels; determine, based on the image, one or more pixels of the plurality of pixels included in the image that contain text; identify, based on the one or more pixels that contain text, a plurality of components in the image, wherein each component of the plurality of components represents a grouping of pixels that contain text; determine a subset of components based on the plurality of components, wherein the subset of components includes one or more components of the plurality of components that include a predetermined minimum number of pixels that contain text; determine, based on the pixels that contain text of the subset of components, one or more candidate text angles, wherein each candidate text angle of the one or more candidate text angles is associated with a plurality of pixels that contain text; determine a global text angle based on the one or more candidate text angles; and determine a first plurality of bounding boxes based on the global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components.
 25. The non-transitory computer-readable storage medium of claim 24, wherein the one or more pixels that contain text are determined using a text detection neural network.
 26. The non-transitory computer-readable storage medium of claim 25, wherein the one or more programs include further instructions, which when executed by the one or more processors of the electronic device, cause the electronic device to: determine, using the text detection neural network, a text probability for each pixel of the plurality of pixels, wherein a pixel of the plurality of pixels contains text if the text probability corresponding to the pixel satisfies a predetermined threshold.
 27. The non-transitory computer-readable storage medium of claim 24, wherein the plurality of components are identified using a seed fill algorithm.
 28. The non-transitory computer-readable storage medium of claim 24, wherein determining the one or more candidate text angles based on the pixels that contain text of the subset of components comprises: determining a text angle for each pixel of the pixels that contain text of the subset of components using a transform; generating a transformation matrix based on the determined text angles; and determining the one or more candidate text angles based on one or more local maxima of the transformation matrix.
 29. The non-transitory computer-readable storage medium of claim 24, wherein the global text angle represents the candidate text angle of the one or more candidate text angles that is associated with a greatest number of pixels that contain text of the subset of components.
 30. The non-transitory computer-readable storage medium of claim 24, wherein the one or more programs include further instructions, which when executed by the one or more processors of the electronic device, cause the electronic device to: prior to determining the first plurality of bounding boxes, determine whether the plurality of pixels associated with the global text angle satisfy a predetermined condition; and in accordance with a determination that the plurality of pixels associated with the global text angle satisfy the predetermined condition, determine the first plurality of bounding boxes based on the global text angle.
 31. The non-transitory computer-readable storage medium of claim 30, wherein the predetermined condition comprises a requirement that the plurality of pixels associated with the global text angle outnumber or equal a threshold number of pixels.
 32. The non-transitory computer-readable storage medium of claim 31, wherein the threshold number of pixels is equal to a sum of all pixels associated with the one or more candidate text angles multiplied by a predetermined threshold constant.
 33. The non-transitory computer-readable storage medium of claim 30, wherein the one or more programs include further instructions, which when executed by the one or more processors of the electronic device, cause the electronic device to: determine, based on the image, a local text angle for each pixel that contains text; and in accordance with a determination that the plurality of pixels associated with the global text angle do not satisfy the predetermined condition, determine a second plurality of bounding boxes based on the local text angle for each pixel that contains text of the subset of components, wherein each bounding box of the second plurality of bounding boxes encloses a component of the plurality of components.
 34. The non-transitory computer-readable storage medium of claim 33, wherein the local text angles are determined using a text detection neural network.
 35. The non-transitory computer-readable storage medium of claim 24, wherein determining the first plurality of bounding boxes based on the global text angle comprises realigning a position of one or more preliminary bounding boxes based on the global text angle, and wherein the one or more preliminary bounding boxes are determined using a text detection neural network.
 36. The non-transitory computer-readable storage medium of claim 24, wherein determining the first plurality of bounding boxes based on the global text angle comprises adjusting one or more dimensions of one or more preliminary bounding boxes based on the global text angle, and wherein the one or more preliminary bounding boxes are determined using a text detection neural network.
 37. The non-transitory computer-readable storage medium of claim 24, wherein the one or more programs include further instructions, which when executed by the one or more processors of the electronic device, cause the electronic device to: display the image at a display; and display, at the display, the first plurality of bounding boxes overlaying the displayed image.
 38. The non-transitory computer-readable storage medium of claim 24, wherein the one or more programs include further instructions, which when executed by the one or more processors of the electronic device, cause the electronic device to: determine whether a predetermined threshold number of pixels of the plurality of pixels associated with the global text angle are located in a first region of the image; and in accordance with a determination that a predetermined threshold number of pixels of the plurality of pixels associated with the global text angle are located in the first region of the image: determine whether a predetermined threshold number of pixels of the plurality of pixels associated with a candidate text angle of the one or more candidate text angles are located in a second region of the image; and in response to determining that a predetermined threshold number of pixels of the plurality of pixels associated with the candidate text angle of the one or more candidate text angles are located in the second region of the image, determine a second global text angle based on the candidate text angle of the one or more candidate text angles.
 39. The non-transitory computer-readable storage medium of claim 38, wherein the one or more programs include further instructions, which when executed by the one or more processors of the electronic device, cause the electronic device to: determine a third plurality of bounding boxes based on the second global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components located in the first region, and wherein each bounding box of the third plurality of bounding boxes encloses a component of the plurality of components located in the second region.
 40. The non-transitory computer-readable storage medium of claim 38, wherein the first region of the image comprises a top half of the image, and wherein the second region of the image comprises a bottom half of the image.
 41. A method, comprising: receiving an image including a plurality of pixels; determining, based on the image, one or more pixels of the plurality of pixels included in the image that contain text; identifying, based on the one or more pixels that contain text, a plurality of components in the image, wherein each component of the plurality of components represents a grouping of pixels that contain text; determining a subset of components based on the plurality of components, wherein the subset of components includes one or more components of the plurality of components that include a predetermined minimum number of pixels that contain text; determining, based on the pixels that contain text of the subset of components, one or more candidate text angles, wherein each candidate text angle of the one or more candidate text angles is associated with a plurality of pixels that contain text; determining a global text angle based on the determined one or more candidate text angles; and determining a first plurality of bounding boxes based on the global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components.
 42. An electronic device, comprising: one or more processors; a memory; and one or more programs wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, wherein the one or more programs include instructions for: receiving an image including a plurality of pixels; determining, based on the image, one or more pixels of the plurality of pixels included in the image that contain text; identifying, based on the one or more pixels that contain text, a plurality of components in the image, wherein each component of the plurality of components represents a grouping of pixels that contain text; determining a subset of components based on the plurality of components, wherein the subset of components includes one or more components of the plurality of components that include a predetermined minimum number of pixels that contain text; determining, based on the pixels that contain text of the subset of components, one or more candidate text angles, wherein each candidate text angle of the one or more candidate text angles is associated with a plurality of pixels that contain text; determining a global text angle based on the determined one or more candidate text angles; and determining a first plurality of bounding boxes based on the global text angle, wherein each bounding box of the first plurality of bounding boxes encloses a component of the plurality of components. 